Fluent Nhibernate 映射问题
我的旧系统使用两个 Access 数据库,因此我为每个数据库使用了单独的 SessionFactory 数据库。我无法使用“FluentMapping.AddFromAssemblyOf”函数来配置映射,因为每个数据库的映射都不同。
在其中一个会话工厂上,我使用了以下代码:
gameDataSessionFactory = Fluently.Configure()
.Database(JetDriverConfiguration.Standard
.ConnectionString(dbConfiguration.GameDataConnString.ConnectionString)
.ShowSql())
.Mappings( x => x.FluentMappings.Add<PitchAndEventMap>())
.Mappings(x => x.FluentMappings.Add<GameMap>())
.BuildSessionFactory();
问题是当首先列出 PitchAndEventMap 时(如上所示),PitchAndEventMap 映射将不起作用。当它列在最后时,它会起作用,但现在 GameMap 的映射将不起作用。我在这里错过了什么吗?
没有错误,但程序不会执行任何查询。请帮我!
谢谢!
My legacy system uses two Access database, so I've used separate SessionFactory for each
database. I can't use "FluentMapping.AddFromAssemblyOf" function to configure the mappings because the mappings are different for each database.
On one of the session factories, I've used the following code:
gameDataSessionFactory = Fluently.Configure()
.Database(JetDriverConfiguration.Standard
.ConnectionString(dbConfiguration.GameDataConnString.ConnectionString)
.ShowSql())
.Mappings( x => x.FluentMappings.Add<PitchAndEventMap>())
.Mappings(x => x.FluentMappings.Add<GameMap>())
.BuildSessionFactory();
The problem is when the PitchAndEventMap is listed first (like above), the PitchAndEventMap mapping will not work. When it is listed last, it will work but now the mapping for GameMap will not work. Am I missing something here?
There's no error but the program will not do any query. Please help me!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您应该将映射放在 lambda 中:
Maybe you should put the mappings together in the lambda: