ModelConfiguration - Convention applied despite being overridden #28091
Labels
area-model-building
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
poachable
type-bug
Milestone
Description
Having a convention configured via
ConfigureConventions
(for instance, giving everydecimal
a precision and scale of 16,2) and then overriding that convention by callingHasPrecision
fails when an entity is referenced asOwns
ANDOwnsMany
within the same code base. In this instance one of the configured columns will have the correct (16,4) decimal definition while the other one will have the incorrect (16,2) definition.Example:
Given these classes:
And this DbContext configuration:
Produces this unexpected migration:
Removing EITHER one of the 2 entities from the DbContext and Configuration returns the expected result of a column with a column type of
decimal(16,4)
.Repo
A Repo to quickly demonstrate the bug can be found here:
https://github.com/Jejuni/EfCoreConventionProblem
Provider and version information
EF Core version: 6.0.5 (tested in 6.0.4 - 6.0.5, but probably present in all version since introduction of convention feature)
dotnet-ef version 6.0.5
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.2.1
The text was updated successfully, but these errors were encountered: