Closed robertocorona closed 9 years ago
This is an EF issue - you need to define your decimal precision as part of the EF model - it defaults to 2.
See: http://stackoverflow.com/questions/3504660/decimal-precision-and-scale-in-ef-code-first
Hi Josh,
thanks for supporting Roberto! :)
I have this example
public class Concept { public Guid IdConcept { get; set; } public string Name { get; set; } public decimal Price { get; set; } }
var newConcept = new Concept { IdConcept = Guid.NewGuid(), Name = "new 1", Price = Convert.ToDecimal(0.123456) };
context.UpdateGraph(newConcept);
But when stored in the database the stored decimal value is "0.12" only accepts 2 decimal places The field in the database is defined decimal (18, 6)
This is just an example, I use actually context.UpdateGraph(studentClass, map => map .OwnedCollection(a => a.CoursesCollection)); and collections happens exactly the same. Also this error happens if I just keep a single entity.