在 Fluent NHibernate 中将一对一关系组合成一个对象
我的数据库中有一对一的关系,我想将其合并到 Fluent NHibernate 中的一个对象中。我所讨论的具体表是来自默认 ASP.NET Membership 实现的 aspnet_Users 和 aspnet_Membership 表。我想将它们合并到一个简单的 User 对象中,并且只获取我想要的字段。
我还想将其设置为只读,因为我想使用内置的 ASP.NET Membership API 进行修改。我只是想利用延迟加载的优势。
任何帮助将不胜感激。谢谢!
I have a one-to-one relationship in my database, and I'd like to just combine that into one object in Fluent NHibernate. The specific tables I am talking about are the aspnet_Users and aspnet_Membership tables from the default ASP.NET Membership implementation. I'd like to combine those into one simple User object and only get the fields I want.
I would also like to make this read-only, as I want to use the built-in ASP.NET Membership API to modify. I simply want to take advantage of lazy-loading.
Any help would be appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如何使用 Fluent NHibernate 的
Join
方法来连接映射中的表。请参阅 James Gregory 的此问题的答案。How about using the
Join
method of Fluent NHibernate to join the tables in your mapping. See James Gregory's answer in this question.这是我完成的映射:
Here's my completed mapping: