1 public class EFDbContext : DbContext
2 {
3    protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
4    {
5        modelBuilder.Entity<Class>().Property(object => object.property).HasPrecision(12, 10);
6 
7        base.OnModelCreating(modelBuilder);
8    }
9 }
1 public DecimalPropertyConfiguration HasPrecision(
2 byte precision,
3 byte scale )

This is to show how to configure the precision by overriding the DbContext.OnModelCreating() method.

You can check information about this on the page:http://stackoverflow.com/questions/3504660/entity-framework-code-first-decimal-precision-and-scale

相关文章:

  • 2022-12-23
  • 2021-07-25
  • 2021-10-03
  • 2021-05-17
  • 2022-03-04
  • 2021-08-24
  • 2021-08-12
  • 2021-08-02
猜你喜欢
  • 2022-01-07
  • 2021-09-29
  • 2021-08-29
  • 2021-08-07
  • 2021-11-25
  • 2022-12-23
相关资源
相似解决方案