-
Notifications
You must be signed in to change notification settings - Fork 3.3k
HasPrecision() does not override [Column(TypeName=data_type(precision, scale))] #21061
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
We decided the above scenario was by design (column type being an exception to the usual "fluent API trumps annotations" approach). But how about this?
CREATE TABLE [Precisions] (
[Id] int NOT NULL IDENTITY,
[Score] decimal NOT NULL,
CONSTRAINT [PK_Precisions] PRIMARY KEY ([Id])
); i.e. no precision or scale specified in the SQL data type, so SQL Server at least would use its default of decimal(18,2).
And so does Both Summing up: currently Do we want to change any of this? |
For comparison, EF6 throws an exception, e.g. "The store type 'decimal(17,5)' could not be found in the SqlServer provider manifest", if the column type contains any precision or scale. You can set it to just E.g. |
Decisions from meeting 6/1/2020:
|
If you set up the code below:
And then do
Add-Migration
followed byScript-Migration
you get the following SQL. I.e. the column type obeyed the annotation and not the fluent API.The text was updated successfully, but these errors were encountered: