{"record":{"id":"e160f930f6740f95","repo":"dotnet/efcore","slug":"entitytype1-property1-and-entitytype2-pr-e160f9","errorCode":null,"errorMessage":"'{entityType1}.{property1}' and '{entityType2}.{property2}' are both mapped to column '{columnName}' in '{table}', but are configured to use different stored computed column settings ('{value1}' and '{value2}').","messagePattern":"'(.+?)\\.(.+?)' and '(.+?)\\.(.+?)' are both mapped to column '(.+?)' in '(.+?)', but are configured to use different stored computed column settings \\('(.+?)' and '(.+?)'\\)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":1692,"sourceCode":"        if (!currentComputedColumnSql.Equals(previousComputedColumnSql, StringComparison.OrdinalIgnoreCase))\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameComputedSqlMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName(),\n                    previousComputedColumnSql,\n                    currentComputedColumnSql));\n        }\n\n        var currentStored = property.GetIsStored(storeObject);\n        var previousStored = duplicateProperty.GetIsStored(storeObject);\n        if (currentStored != previousStored)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameIsStoredMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName(),\n                    previousStored,\n                    currentStored));\n        }\n\n        var hasDefaultValue = property.TryGetDefaultValue(storeObject, out var currentDefaultValue);\n        var duplicateHasDefaultValue = duplicateProperty.TryGetDefaultValue(storeObject, out var previousDefaultValue);\n        if ((hasDefaultValue\n                || duplicateHasDefaultValue)\n            && !Equals(currentDefaultValue, previousDefaultValue))\n        {\n            currentDefaultValue = GetDefaultColumnValue(property, storeObject);","sourceCodeStart":1674,"sourceCodeEnd":1710,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L1674-L1710","documentation":"Two properties mapped to the same column specify different IsStored settings for computed columns (one stored physically, the other virtual/computed on read). The physical column can only have one stored-ness, so EF aborts. Thrown from ValidateCompatible via GetIsStored(storeObject).","triggerScenarios":"Sibling TPH types where one calls HasComputedColumnSql(sql, stored: true) and the other HasComputedColumnSql(sql, stored: false) (or defaults) for the same column; an owned entity and owner disagreeing on stored; table splitting with mismatched stored flags.","commonSituations":"Tuning a computed column from virtual to persisted on one entity only; cross-provider porting where the default stored-ness changed; copy-paste of config that lost the stored argument on one side.","solutions":["Set HasComputedColumnSql(sql, stored: x) with the same x value on both properties.","Rename one column via HasColumnName if stored-ness legitimately differs.","Split the conflicting entity into its own table."],"exampleFix":"// before\nmodelBuilder.Entity<Student>().Property(s => s.Total).HasComputedColumnSql(\"[A]+[B]\", stored: true);\nmodelBuilder.Entity<Teacher>().Property(t => t.Total).HasComputedColumnSql(\"[A]+[B]\", stored: false);\n// after\nmodelBuilder.Entity<Student>().Property(s => s.Total).HasComputedColumnSql(\"[A]+[B]\", stored: true);\nmodelBuilder.Entity<Teacher>().Property(t => t.Total).HasComputedColumnSql(\"[A]+[B]\", stored: true);","handlingStrategy":"validation","validationCode":"using (var ctx = new MyContext()) { ctx.Model.ToDebugString(); }\nvar a = ctx.Model.FindEntityType(typeof(Student))!.FindProperty(\"Total\")!.GetIsStored();\nvar b = ctx.Model.FindEntityType(typeof(Teacher))!.FindProperty(\"Total\")!.GetIsStored();\nDebug.Assert(a == b, $\"IsStored mismatch: {a} vs {b}\");","typeGuard":null,"tryCatchPattern":"try { using var ctx = new MyContext(); _ = ctx.Model; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"stored computed column settings\"))\n{ log.Error(\"IsStored mismatch on shared computed column: {Msg}\", ex.Message); throw; }","preventionTips":["Always pass the stored argument explicitly via HasComputedColumnSql(sql, stored: x) and share the value.","Document per-column stored-ness in a single configuration.","Cover the assertion in a startup model-build test."],"tags":["ef-core","model-validation","computed-column","stored","shared-table"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}