具有 RIA 服务的流畅 NHibernate 自动映射

发布于 2024-08-29 11:19:38 字数 480 浏览 3 评论 0原文

我最近遇到了一个小问题,或者更确切地说,缺乏对 NHibernate 自动映射如何与 RIA 数据服务配合使用的理解。

也就是说,我不明白如何使用 AssociationInclude 属性。例如,我在数据库中创建了两个表和相应的类(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦晓ヶ微光ヅ倾城 2024-09-05 11:19:38

我已经成功解决了这个问题。显然问题是我没有使用 Association 和 Include 属性。

I've managed to solve the issue. Apparently the problem was that I wasn't using Association and Include attributes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文