You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change "double" to "float" in MyEntity, and put an "f" beside the floating-point values in HasData. This results in precise floats being generated.
For reference, our system's first migration contains the doubles precisely and it was generated using version 2.1.1.
Further technical details
EF Core version: 2.2.4
.NET SDK: 2.2.104
Database Provider: Microsoft.EntityFrameworkCore.Sqlite (though in our "real" code we use SqlServer)
Operating system: Windows 10 Enterprise
IDE: Visual Studio 15.9.7
The text was updated successfully, but these errors were encountered:
@edwiles We discussed this in triage and we don't believe there is any error here. The nature of floating point representations means that values often cannot be represented exactly. This means that 0.00404686 as a C# literal is exactly the same value as 0.0040468600000000002. (This is pretty easy to check.)
The change we made from 2.1 is to avoid other cases of data loss by always writing the literals out with full precision.
If HasData is used to seed fields of type double, the generated migration often loses precision in the values.
Steps to reproduce
The generated migration seeds the data but uses imprecise values:
For reference, our system's first migration contains the doubles precisely and it was generated using version 2.1.1.
Further technical details
EF Core version: 2.2.4
.NET SDK: 2.2.104
Database Provider: Microsoft.EntityFrameworkCore.Sqlite (though in our "real" code we use SqlServer)
Operating system: Windows 10 Enterprise
IDE: Visual Studio 15.9.7
The text was updated successfully, but these errors were encountered: