問題の回避策を見つけたのと同じ問題がありました。ダブルをラップするだけですか?基本エンティティで倍増するプロパティ。Hier はコードです:
Notmapped エンティティ (Wrapper エンティティ) は外部から使用され、もう 1 つは DB から格納およびロードされます。
継承されたエンティティ コード:
[NotMapped]
public double Longitude
{
get
{
return this.FromNullable(this.longitude);
}
set
{
this.PropertyChange(ref this.longitude, value);
}
}
[Column("Longitude")]
public double? LongitudeStored
{
get
{
return this.longitude;
}
set
{
this.PropertyChange(ref this.longitude, value);
}
}
Hier は基本エンティティ コードです。
protected double FromNullable(double? value)
{
return value.HasValue ? value.Value : double.NaN;
}
protected void PropertyChange(ref double? propertyValue, double newValue, [CallerMemberName] string propertyName = "")
{
this.PropertyChangeCore(ref propertyValue, double.IsNaN(newValue) ? (double?)null : (double?)newValue, propertyName);
}
protected void HandlePropertyCore(ref double? propertyValue, double? newValue, [CallerMemberName] string propertyName = "")
{
if ((newValue.HasValue || propertyValue.HasValue) && // If both are null than do not fire.
((!propertyValue.HasValue || double.IsNaN(propertyValue.Value))
^ (!newValue.HasValue || double.IsNaN(newValue.Value)) // If one of them is null or NaN then fire according to XOr rule.
|| Math.Abs(propertyValue.Value - newValue.Value) > double.Epsilon)) // If the are not the same than fire.
{
propertyValue = newValue;
this.HandlePropertyCore(propertyName); // HERE YOU NEED JUST TO HANDLE DOUBLE PROPERTY
}
}