我是流利的NHibernate的新手.现在我遇到映射复合键的一个问题.任何人都可以指出URL或样品吗?
有一种CompositeId
方法.
public class EntityMap : ClassMap{ public EntityMap() { CompositeId() .KeyProperty(x => x.Something) .KeyReference(x => x.SomethingElse); } }
如果这是你的第一堂课
public class EntityMap : ClassMap{ public EntityMap() { UseCompositeId() .WithKeyProperty(x => x.Something) .WithReferenceProperty(x => x.SomethingElse); } }
这是第二个参考实体
public class SecondEntityMap : ClassMap{ public SecondEntityMap() { Id(x => x.Id); .... References (x => x.EntityProperty) .WithColumns("Something", "SomethingElse") .LazyLoad() .Cascade.None() .NotFound.Ignore() .FetchType.Join(); } }