如何使用 Fluent nhibernate 创建表/类映射?

发布于 2024-07-20 22:40:17 字数 489 浏览 4 评论 0原文

我正在尝试使用流畅的 nhibernate 创建类似于以下内容的映射:

<class name="IAccountManager" 
    abstract="true" 
    table="IAccountManager">

    <id name="Id">
            <generator class="hilo"/>
    </id>

    <union-subclass
            table="DefaultAccountManager"
            name="DefaultAccountManager">
            <property name="FirstName"/>
    </union-subclass>

    ... more subclasses
</class>

关于如何做到这一点的想法?

I'm trying to create a mapping similar to the following with fluent nhibernate:

<class name="IAccountManager" 
    abstract="true" 
    table="IAccountManager">

    <id name="Id">
            <generator class="hilo"/>
    </id>

    <union-subclass
            table="DefaultAccountManager"
            name="DefaultAccountManager">
            <property name="FirstName"/>
    </union-subclass>

    ... more subclasses
</class>

Thoughts on how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

¢蛋碎的人ぎ生 2024-07-27 22:40:17

Fluent NHibernate 目前不支持 Union 子类。 FNH 允许您混合流利和 hbm 映射,因此您应该保留这种情况下的 hbm 映射。

Union-subclasses currently aren't supported by Fluent NHibernate. FNH allows you to mix fluent and hbm mappings, so you should keep the hbm mappings for this case.

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