Reputation: 495
I have the following class
public class InvestorsLottery : Lottery
{
[Column(TypeName = "decimal(14, 2)")]
public decimal Investment { get; set; }
[Required]
public int Percentage { get; set; }
[Required]
[Column(TypeName = "decimal(30, 18)")]
public decimal InvestmentEth
{
get { return _investmentEth; }
set {
_investmentEth = Investment / EthPrice;
value = _investmentEth
}
}
private decimal _investmentEth;
}
with the following fluent api
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<InvestorsLottery>()
.Property(p => p.InvestmentEth)
.HasField("_investmentEth")
.UsePropertyAccessMode(PropertyAccessMode.Field);
}
but the value of InvestmentEth stays zero - how can I change this?
Upvotes: 0
Views: 192