0
我有一个通用的对象类型实体和一些可以与实体相关的类,如EntityDescription和EntityLocation(多对一关系)。抽象中间类的NHibernate(流利)映射
实体类:
public class Entity
{
public virtual Int64 ID { get; set; }
// and other properties
}
EntityDescription类:
public class EntityDescription
{
public virtual Int64 ID { get; set; }
public virtual Entity Entity { get; set; }
public virtual String Description { get; set; }
// and other properties
}
EntityLocation类:
public class EntityLocation
{
public virtual Int64 ID { get; set; }
public virtual Entity Entity { get; set; }
public virtual String Location { get; set; }
// and other properties
}
有一些更具体的实体类型的例如公司,供应商,员工等 为了使事情更有趣,EntityDescription适用于所有特定类型,但只有一些类型可以分配位置(EntityLocation仅适用于某些类型)。
如何在Fluent-NHibernate中映射这些类,以便EntityLocation列表仅暴露于某些可以具有位置的特定类(例如Company和Supplier),而不是泛型Entity类?
// This property can exist in Entity
public virtual IList<EntityDescription> Descriptions { get; set; }
// I want this property to only exist in some specific types, not in Entity
public virtual IList<EntityLocation > Locations { get; set; }
任何帮助表示赞赏。提前致谢。