Details
No Type Specified for the Decimal Column
To add precision for decimal fields
Open the ApplicationDbContext
and modify the OnModelCreating
method
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<DeviceTransaction>()
.Property(d => d.Amount)
.HasPrecision(18, 2);
}
You can also just use the data annotation [Precision(18, 2)]
to achieve the same result
This will prevent the database from silently truncating the value