【发布时间】:2009-11-26 06:34:53
【问题描述】:
我正在尝试执行以下操作,但它抱怨“未找到 'extends' 引用的类”。我想我需要为每种具体类型的 Component 进行映射,但我不能指定 Attributes.Class 两次..
代码如下:
[NHibernate.Mapping.Attributes.Class(Table = "Components", Abstract = true,
NameType = typeof (Component<ContentItem>))]
public abstract class Component<T> : IComponent<T> where T : ContentItem
{
...
}
[NHibernate.Mapping.Attributes.JoinedSubclass(Table = "ComponentA", ExtendsType = typeof(Component<ItemA>))]
public class ComponentA : Component<ItemA>
{
...
}
[NHibernate.Mapping.Attributes.JoinedSubclass(Table = "ComponentB", ExtendsType = typeof(Component<ItemB>))]
public class ComponentB : Component<ItemB>
{
...
}
ItemA 和 ItemB 继承自 ContentItem 并且都是映射的。
【问题讨论】:
标签: c# .net nhibernate nhibernate-mapping