{"record":{"id":"2f94262d4e34b1bb","repo":"dotnet/efcore","slug":"entitytype1-property1-and-entitytype2-pr-2f9426","errorCode":null,"errorMessage":"'{entityType1}.{property1}' and '{entityType2}.{property2}' are both mapped to column '{columnName}' in '{table}', but are configured with different scales ('{scale1}' and '{scale2}').","messagePattern":"'(.+?)\\.(.+?)' and '(.+?)\\.(.+?)' are both mapped to column '(.+?)' in '(.+?)', but are configured with different scales \\('(.+?)' and '(.+?)'\\)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":1606,"sourceCode":"        if (currentPrecision != previousPrecision)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNamePrecisionMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName(),\n                    currentPrecision,\n                    previousPrecision));\n        }\n\n        var currentScale = property.GetScale(storeObject);\n        var previousScale = duplicateProperty.GetScale(storeObject);\n        if (currentScale != previousScale)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameScaleMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName(),\n                    currentScale,\n                    previousScale));\n        }\n\n        if (property.IsConcurrencyToken != duplicateProperty.IsConcurrencyToken)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameConcurrencyTokenMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),","sourceCodeStart":1588,"sourceCodeEnd":1624,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L1588-L1624","documentation":"Two properties mapped to the same column specify different Scale values (the decimal places portion). Even if precision matches, scale must agree because the physical column's scale is a single value. Thrown from ValidateCompatible via GetScale(storeObject).","triggerScenarios":"Sibling TPH types calling HasPrecision(18, 2) and HasPrecision(18, 4) respectively for the same column name; an owned decimal whose scale differs from the owner's mirrored column; table-splitting where the two entity classes set different scales.","commonSituations":"Changing scale on a financial column from 2 to 4 places in one entity only; converting a measurement value to higher resolution on one branch of a hierarchy; cross-team ownership of sibling entities causing divergence.","solutions":["Pick one canonical scale and set it on both properties via HasPrecision(precision, scale).","Use HasColumnName to separate the columns when scale genuinely differs.","Split one entity to its own table via ToTable."],"exampleFix":"// before\nmodelBuilder.Entity<Student>().Property(s => s.Amount).HasPrecision(18, 2);\nmodelBuilder.Entity<Teacher>().Property(t => t.Amount).HasPrecision(18, 4);\n// after\nmodelBuilder.Entity<Student>().Property(s => s.Amount).HasPrecision(18, 4);\nmodelBuilder.Entity<Teacher>().Property(t => t.Amount).HasPrecision(18, 4);","handlingStrategy":"validation","validationCode":"using (var ctx = new MyContext()) { ctx.Model.ToDebugString(); }\nvar a = ctx.Model.FindEntityType(typeof(Student))!.FindProperty(\"Amount\")!.GetScale();\nvar b = ctx.Model.FindEntityType(typeof(Teacher))!.FindProperty(\"Amount\")!.GetScale();\nDebug.Assert(a == b, $\"Scale mismatch: {a} vs {b}\");","typeGuard":null,"tryCatchPattern":"try { using var ctx = new MyContext(); _ = ctx.Model; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"different scales\"))\n{ log.Error(\"Scale mismatch on shared column: {Msg}\", ex.Message); throw; }","preventionTips":["Always set precision and scale together via HasPrecision(p, s) and reuse the same pair across siblings.","Cover scale parity in a startup model-build test.","Document the canonical scale for financial/measurement columns."],"tags":["ef-core","model-validation","scale","numeric","shared-table"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}