A custom annotation for Entity Framework which allows you to specify decimal precision on a property.
##USAGE
-
Add the Precision.cs file to your data project and set the proper namespace
-
In your Entity Framework Context OnModelBuilder function, call the Precision.ConfigureModelBuilder() method
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); // Precision attribute for decimals Precision.ConfigureModelBuilder(modelBuilder); }
-
Apply the annotation to your decimal properties in your code first models
[Precision(18,4)] public decimal quantity { get; set; }