{"record":{"id":"a3bcd6ddce8868de","repo":"dotnet/efcore","slug":"entitytype1-property1-and-entitytype2-pr-a3bcd6","errorCode":null,"errorMessage":"'{entityType1}.{property1}' and '{entityType2}.{property2}' are both mapped to column '{columnName}' in '{table}', but are configured with different precisions ('{precision1}' and '{precision2}').","messagePattern":"'(.+?)\\.(.+?)' and '(.+?)\\.(.+?)' are both mapped to column '(.+?)' in '(.+?)', but are configured with different precisions \\('(.+?)' and '(.+?)'\\)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":1590,"sourceCode":"        }\n\n        if (property.IsFixedLength(storeObject) != duplicateProperty.IsFixedLength(storeObject))\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameFixedLengthMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName()));\n        }\n\n        var currentPrecision = property.GetPrecision(storeObject);\n        var previousPrecision = duplicateProperty.GetPrecision(storeObject);\n        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(),","sourceCodeStart":1572,"sourceCodeEnd":1608,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L1572-L1608","documentation":"Two properties sharing a column specify different Precision values (for decimal/numeric types). The validator cannot pick which precision to materialize and throws during model finalization. Thrown from ValidateCompatible via GetPrecision(storeObject) facet comparison.","triggerScenarios":"A same-named decimal on sibling TPH types where one calls HasPrecision(18,2) and the other HasPrecision(10,4); an owned money property with precision set while the owner's matching column differs; table splitting with mismatched precision.","commonSituations":"Refactoring a financial Amount property to higher precision in one entity without updating the sibling; copying entity configs from another project where precision differs; mixing [Precision] data annotation with Fluent HasPrecision on different sides.","solutions":["Standardize on one (precision, scale) pair and apply HasPrecision(p,s) to both properties.","Rename one column with HasColumnName if the two values legitimately need different precisions.","Move one type to its own table via ToTable so the columns no longer share."],"exampleFix":"// before\nmodelBuilder.Entity<Student>().Property(s => s.Score).HasPrecision(5, 2);\nmodelBuilder.Entity<Teacher>().Property(t => t.Score).HasPrecision(7, 3);\n// after\nmodelBuilder.Entity<Student>().Property(s => s.Score).HasPrecision(7, 3);\nmodelBuilder.Entity<Teacher>().Property(t => t.Score).HasPrecision(7, 3);","handlingStrategy":"validation","validationCode":"using (var ctx = new MyContext()) { ctx.Model.ToDebugString(); }\nvar a = ctx.Model.FindEntityType(typeof(Student))!.FindProperty(\"Score\")!.GetPrecision();\nvar b = ctx.Model.FindEntityType(typeof(Teacher))!.FindProperty(\"Score\")!.GetPrecision();\nDebug.Assert(a == b, $\"Precision mismatch: {a} vs {b}\");","typeGuard":null,"tryCatchPattern":"try { using var ctx = new MyContext(); _ = ctx.Model; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"different precisions\"))\n{ log.Error(\"Precision mismatch on shared column: {Msg}\", ex.Message); throw; }","preventionTips":["Define precision/scale constants for money/score types and reuse them across the hierarchy.","Use a shared IEntityTypeConfiguration for numeric properties in shared-table entities.","Add a model-build test that asserts precision parity."],"tags":["ef-core","model-validation","precision","numeric","shared-table"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}