流畅的 NHibernate 自动映射器:跳过带有每个子类表的中间类

发布于 2024-08-21 18:08:45 字数 405 浏览 1 评论 0原文

我使用 Fluent NHibernate 映射器和每个子类一个表来映射以下结构:

public abstract class A
{
    // properties here
}

public abstract class B : A
{
    // methods here
}

public class C : B
{
    // properties here
}

我的数据库只有表来表示类 A 和类 C。为了方便起见,类 B 仅存在于我的模型中,并且不包含任何需要映射的属性。

如何让自动映射器跳过 B 并将 C 映射为 A 的子类?

I'm using the Fluent NHibernate mapper with table-per-subclass to map the following structure:

public abstract class A
{
    // properties here
}

public abstract class B : A
{
    // methods here
}

public class C : B
{
    // properties here
}

My database only has tables to represent class A and class C. Class B exists only in my model for my convenience and doesn't contain any properties that needs to be mapped.

How can I get the automapper to skip B and map C as a subclass of A?

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

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

发布评论

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

评论(1

假扮的天使 2024-08-28 18:08:45

Fluent NHibernate wiki 有一个关于 自动映射时忽略基本类型可能值得一读。

The Fluent NHibernate wiki has a section on ignoring base types when automapping that might be worth reading.

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