具有 RIA 服务的流畅 NHibernate 自动映射
我最近遇到了一个小问题,或者更确切地说,缺乏对 NHibernate 自动映射如何与 RIA 数据服务配合使用的理解。
也就是说,我不明白如何使用 Association
和 Include
属性。例如,我在数据库中创建了两个表和相应的类(NHibernate 正确填充)。问题是,RIA 不会在客户端生成由外键绑定到其他表的属性(集合),尽管我已经在域模型的类中定义了它们......它只生成属于它们的属性自己的类,在客户端。
我认为这些属性不是必需的,因为 NHibernate 自动映射器应该自己填充这些集合......我对其工作原理感到非常困惑。我不明白为什么 RIA 简单地跳过自动生成期间等属性
public virtual IList<Medication> Medications{ get; set; }
。
任何意见表示赞赏
谢谢
I've encountered a slight problem recently, or rather a lack of understanding of how NHibernate automapping works with RIA data services.
Namely, I don't understand how to use Association
and Include
attributes. For instance, I've created two tables in my database and corresponding classes (that NHibernate correctly fills). The problem is, RIA doesn't generate properties (collections) bound by foreign key to other tables, on the client side, although I've defined them in my classes in my domain model... it generates just properties that belong to their own class, on the client side.
I assume that these attributes aren't necessary since NHibernate automapper is supposed to fill those collections on it's own... I'm quite confused as to how this works. And I don't understand why RIA simply skips properties such as
public virtual IList<Medication> Medications{ get; set; }
during autogeneration.
Any input is appreciated
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经成功解决了这个问题。显然问题是我没有使用 Association 和 Include 属性。
I've managed to solve the issue. Apparently the problem was that I wasn't using Association and Include attributes.