我似乎缺少一些基本的NHibernate技能.稍微阅读一下,似乎你需要让子对象负责一对多的关系.
这解决了我的问题:
public class VesselMap: ClassMap{ public VesselMap() { //... HasMany(x => x.Details) .Inverse() .WithKeyColumn("BoatId"); } } public class VesselDetailMap:ClassMap { public VesselDetailMap() { //.. References(x => x.Vessel, "BoatId") .Cascade .SaveUpdate(); } }