NHibernate映射用于多接口
|
考虑以下接口和类...
public interface ICategoryParent
{
ICollection<Category> Categories { get; set; }
}
public interface IColorParent
{
ICollection<Color> Colors { get; set; }
}
public class Category
{
public string Name { get; set; }
public ICategoryParent Parent { get; set; }
}
public class Color
{
public string Hue { get; set; }
public IColorParent Parent { get; set; }
}
public class ObjectA : ICategoryParent, IColorParent
{
//[....] Some other properties
ICollection<Category> Categories { get; set; }
ICollection<Color> Colors { get; set; }
}
public class ObjectB : ICategoryParent, IColorParent
{
//[....] Some other properties
ICollection<Category> Categories { get; set; }
ICollection<Color> Colors { get; set; }
}
有人可以为我指出正确在NHibernate(或Fluent NHibernate)中进行映射的正确方向吗?
理想情况下,“类别”和“颜色”表应有一个“鉴别符”列,以让我们知道具体的“父类型”的类型。我还希望ObjectA和ObjectB热切地加载Categories和Colors属性。
谢谢,
马特
没有找到相关结果
已邀请:
0 个回复