覆盖 Fluent 映射
我有一个名为 MyApp.Mapping.dll 的映射程序集,它映射许多实体,并且我还有以下映射:
public class UserMap : ClassMap<User>
//(...)
HasManyToMany(p => p.Roles).Not.LazyLoad()
//(...)
无论出于何种原因,角色关联都被映射为非延迟加载。
出于一个非常具体的原因,我想延迟映射此关联,并且根据我的研究,不可能在标准中获取急切的映射关联作为延迟。
所以问题是:
我可以在另一个程序集中创建另一个映射类来覆盖 UserMap 映射,以便我可以为其他实体重用 MyApp.Mappings.dll 吗?
I have a mapping assembly called MyApp.Mapping.dll which maps lots of entities and I also have the following mapping:
public class UserMap : ClassMap<User>
//(...)
HasManyToMany(p => p.Roles).Not.LazyLoad()
//(...)
The Roles association is mapped as not lazyload for whatever reason.
For a ver specific reason I want to Lazy map this association and for what I have researched, it is not possible to fetch a eager mapped association as Lazy in a Criteria.
So the question is:
Can I create another mapping class in another assembly that overrides UserMap mapping so that I can reuse MyApp.Mappings.dll for other entities?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以构建配置对象,然后
希望有帮助
you can build up the configuration object and then
Hope that helps