NHibernate 在单独程序集中子类时的继承映射

发布于 2024-07-09 10:39:34 字数 215 浏览 6 评论 0原文

假设核心项目有一个基本实体,并且每个插件都可能扩展该基本实体。

解决方案结构:

Application.Core.BaseClass
Application.Module.SubClass (it's a plug in, maybe not available)

有什么方法可以使用 NHibernate 子类来实现此映射吗?

Assume that the core project has a base entity and every plugin maybe extends the base entity.

Solution structure :

Application.Core.BaseClass
Application.Module.SubClass (it's a plug in, maybe not available)

Is any way to implement this mapping using NHibernate subclass?

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

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

发布评论

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

评论(1

素手挽清风 2024-07-16 10:39:34

您可以添加这样的映射:

<?xml version="1.0" encoding="utf-16"?>
<hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"" xmlns=""urn:nhibernate-mapping-2.2">
    <subclass name="SubClass" extends="BaseClass" discriminator-value="SubClass"/>
</hibernate-mapping>

然后

cfg.AddXml(xml);

您可以查看 具有类似目标的项目

还可以选择直接调用类模型。

You can add a mapping with like this:

<?xml version="1.0" encoding="utf-16"?>
<hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"" xmlns=""urn:nhibernate-mapping-2.2">
    <subclass name="SubClass" extends="BaseClass" discriminator-value="SubClass"/>
</hibernate-mapping>

And then

cfg.AddXml(xml);

You could take a look at code from a project with similar goals.

There is also the option of directly invoking the class model.

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