EntityFramework学习笔记之Decimal精度控制

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

posted @ 2013-04-25 15:45  super 86  阅读(412)  评论(0编辑  收藏  举报