次のクラスと流暢なマップが与えられた私の他の質問に加えて、関連する人物が削除されたときに DriversLicense を自動的にカスケード削除する方法はありますか? Person クラスに DriversLicense クラスの知識を持たせたくありませんが、Person が削除された場合に孤立したデータも必要としません。
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 );
}
}