これが私のモデルです:
public class Investment : FullAuditedEntity<Guid>
{
public string some_property { get; set; }
public Address Address { get; set; }
}
public class Address : ValueObject<Address>
{
[ForeignKey("CountryId")]
public Country Country { get; set; }
[Required]
public int CountryId { get; set; }
[ForeignKey("StateId")]
public State State { get; set; }
public string StateId { get; set; }
[ForeignKey("DistrictId")]
public District District { get; set; }
public string DistrictId { get; set; }
[ForeignKey("CommuneId")]
public Commune Commune { get; set; }
public string CommuneId { get; set; }
[Required]
public string City { get; set; }
public string Street { get; set; }
}
新しい投資を作成して DB に保存しようとすると、ABP はエンティティの変更を履歴テーブルに保存する必要があるかどうかを識別しようとしますが、所有エンティティ (アドレス) の所有者 (投資) を識別しようとするとクラッシュします。これは、ABP が常に最初の外部キーを取得するためです (所有者エンティティとの関係を前提としています) が、私の場合、最初の外部キーは他のエンティティとの関係であるため、「PrincipalToDependent」値がなく、保存アクションが終了します。
これに対する回避策はありますか、または所有エンティティ タイプに参照を格納することはできませんか?


