I'm doing an insert into the database (SQL Server 2008) of a field set to 'decimal (10,4)', of which I try to insert / edit, through my C # application MVC5, a field of my model type 'decimal'.
The fact is that when I debug the code, even before the moment of 'context.SaveChanges ()', it has the correct decimal places, eg 0.89999. However, when I do the SaveChanges it ends up writing to the database as follows '0.8900'.
I'm using EF 6.1.3 with reverse engineering to generate the models (DbFirst). When I enter the command below into my context class that is automatically generated, it works normally, however I have to change every time the database is updated.
modelBuilder.Entity<Class>().Property(object => object.property).HasPrecision(12, 10);
NOTE: All my methods that I need to insert fields in this condition are also not written with the four decimal places, but with only 2.