{"record":{"id":"8c2e8f02c1119aa5","repo":"dotnet/efcore","slug":"entitytype1-property1-and-entitytype2-pr-8c2e8f","errorCode":null,"errorMessage":"'{entityType1}.{property1}' and '{entityType2}.{property2}' are both mapped to column '{columnName}' in '{table}', but have different unicode configurations.","messagePattern":"'(.+?)\\.(.+?)' and '(.+?)\\.(.+?)' are both mapped to column '(.+?)' in '(.+?)', but have different unicode configurations\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":1564,"sourceCode":"        var currentMaxLength = property.GetMaxLength(storeObject);\n        var previousMaxLength = duplicateProperty.GetMaxLength(storeObject);\n        if (currentMaxLength != previousMaxLength)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameMaxLengthMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName(),\n                    previousMaxLength,\n                    currentMaxLength));\n        }\n\n        if (property.IsUnicode(storeObject) != duplicateProperty.IsUnicode(storeObject))\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.DuplicateColumnNameUnicodenessMismatch(\n                    duplicateProperty.DeclaringType.DisplayName(),\n                    duplicateProperty.Name,\n                    property.DeclaringType.DisplayName(),\n                    property.Name,\n                    columnName,\n                    storeObject.DisplayName()));\n        }\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,","sourceCodeStart":1546,"sourceCodeEnd":1582,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L1546-L1582","documentation":"Two properties sharing a column disagree on the Unicode (IsUnicode) configuration. Unicode-ness changes the store type (e.g. nvarchar vs varchar), so conflicting settings would produce an ambiguous schema. EF validates this strictly rather than silently picking one.","triggerScenarios":"ValidateCompatible() checks property.IsUnicode(storeObject) != duplicateProperty.IsUnicode(storeObject) for two properties mapped to the same column. One is configured IsUnicode(true) and the other IsUnicode(false).","commonSituations":"Table-splitting where the owner uses a unicode column but the owned/detail type explicitly opts out of unicode; mixed data annotations; a database-first scaffold followed by manual edits that changed unicode on only one entity.","solutions":["Apply the same IsUnicode(...) value to both properties.","Remove the explicit IsUnicode from one side so it uses the convention default (true for string).","If they really need different encodings, map them to distinct columns."],"exampleFix":"// before\nmodelBuilder.Entity<Account>().Property(a => a.Code).IsUnicode(true);\nmodelBuilder.Entity<AccountSettings>().Property(s => s.Code).IsUnicode(false); // shared column\n\n// after\nmodelBuilder.Entity<Account>().Property(a => a.Code).IsUnicode(true);\nmodelBuilder.Entity<AccountSettings>().Property(s => s.Code).IsUnicode(true);","handlingStrategy":"validation","validationCode":"foreach (var (col, props) in sharedColumnGroups)\n{\n    var flags = props.Select(p => p.IsUnicode(storeObject)).Distinct().ToList();\n    if (flags.Count > 1)\n        Console.WriteLine($\"Column {col} has conflicting unicode settings\");\n}","typeGuard":null,"tryCatchPattern":"try { _ = db.Model; } catch (InvalidOperationException ex) when (ex.Message.Contains(\"different unicode configurations\")) { // align IsUnicode on both properties }","preventionTips":["Set IsUnicode explicitly once for shared string columns and reuse the same value.","Remember string is unicode by default; only opt out on both sides consistently.","Smoke-test the model at startup."],"tags":["model-validation","column-mapping","unicode","relational"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}