除了我的other question给予以下类和流利的地图,有没有办法自动级联删除DriversLicense相关的人被删除?请注意,我不希望Person类拥有任何有关DriversLicense类的知识,但是如果某个Person被删除,我也不希望孤立的数据。级联删除间接相关的对象与NHibernate
public class PersonMap : ClassMap<Person>
{
public PersonMap() { Id(x => x.Id); }
}
public class PersonMap : ClassMap<Person>
{
public PersonMap() { Id(x => x.Id); }
}
public class DriversLicense
{
public virtual Person Person { get; set; }
public virtual string State { get; set; }
public override bool Equals(object obj){ ... }
public override int GetHashCode(){ ... }
}
public class DriversLicenseMap : ClassMap<DriversLicense>
{
public DriversLicenseMap()
{
UseCompositeId().WithKeyReference(x => x.Person);
Map(x => x.State);
}
}
我应该早一点的人可能失去他们的驾驶执照规定,但仍然让我无法级联的其他方式。 :( – 2009-07-14 16:04:16