2012-02-08 8 views
0

Code First Entity Framework 4.2でテーブルの列を作成するときに小数精度を指定する方法を教えてください。列の精度を設定する。 Entity Framework CF

+0

タイトルと質問のテキストは非常に異なり、無関係ですが、aspnetとaspnet-mvcタグがありません... –

答えて

1

はsimplier 1このアプローチにhttp://geekswithblogs.net/danemorgridge/archive/2010/12/20/ef4-code-first-control-unicode-and-decimal-precision-scale-with.aspx

または

を使用してみてください:

How do I prevent decimal values from being truncated to 2 places on save using the EntityFramework 4.1 CodeFirst?

幸運から取ら

public class MyContext : DbContext 
{ 
    public DbSet<Metrics> Metrics { get; set; } 

    protected override void OnModelCreating(DbModelBuilder modelBuilder) 
    { 
     modelBuilder.Entity<Metrics>().Property(x => x.PPM).HasPrecision(4, 3); 
    } 
} 

関連する問題