EntityFramework 학습 노트의 Decimal 정밀도 제어

2143 단어 framework
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

좋은 웹페이지 즐겨찾기