{"record":{"id":"70d94d73e12c689a","repo":"dotnet/efcore","slug":"the-property-property-on-entity-type-entityt","errorCode":null,"errorMessage":"The property '{property}' on entity type '{entityType}' is not mapped to '{table}'.","messagePattern":"The property '(.+?)' on entity type '(.+?)' is not mapped to '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Extensions/RelationalPropertyExtensions.cs","lineNumber":1534,"sourceCode":"    /// <returns>The property found, or <see langword=\"null\" /> if none was found.</returns>\n    public static IProperty? FindSharedStoreObjectRootProperty(\n        this IProperty property,\n        in StoreObjectIdentifier storeObject)\n        => (IProperty?)FindSharedObjectRootProperty(property, storeObject);\n\n    private static IReadOnlyProperty? FindSharedObjectRootProperty(IReadOnlyProperty property, in StoreObjectIdentifier storeObject)\n    {\n        if (property.DeclaringType.IsMappedToJson())\n        {\n            //JSON-splitting is not supported\n            //Issue #28574\n            return null;\n        }\n\n        var column = property.GetColumnName(storeObject);\n        if (column == null)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.PropertyNotMappedToTable(\n                    property.Name, property.DeclaringType.DisplayName(), storeObject.DisplayName()));\n        }\n\n        var rootProperty = property;\n\n        // Limit traversal to avoid getting stuck in a cycle (validation will throw for these later)\n        // Using a hashset is detrimental to the perf when there are no cycles\n        for (var i = 0; i < Metadata.Internal.RelationalEntityTypeExtensions.MaxEntityTypesSharingTable; i++)\n        {\n            var entityType = rootProperty.DeclaringType.ContainingEntityType;\n            IReadOnlyProperty? linkedProperty = null;\n            foreach (var principalProperty in entityType\n                         .FindRowInternalForeignKeys(storeObject)\n                         .SelectMany(static fk => fk.PrincipalEntityType.GetProperties()))\n            {\n                if (principalProperty.GetColumnName(storeObject) == column)\n                {","sourceCodeStart":1516,"sourceCodeEnd":1552,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Extensions/RelationalPropertyExtensions.cs#L1516-L1552","documentation":"Thrown by FindSharedObjectRootProperty when a property has no column mapping for the given store object (table/view). The method resolves the 'root' property across entities sharing a table, but it cannot proceed if GetColumnName returns null — meaning the property is explicitly excluded or unmapped on that store object. This is an internal API typically invoked during migrations/MigrationsSqlGenerator and annotation resolution, not a query-time check.","triggerScenarios":"Calling FindSharedStoreObjectRootProperty(property, storeObject) where the property is not mapped to a column on the specified StoreObjectIdentifier (table, view, function, or SQL query). Happens during migration generation, model differencing, or when a property is explicitly ignored on a table via ToTable(t => t.ExcludeColumnFromMigrations(...)) or IsStored after schema changes.","commonSituations":"A property was configured with a column name only for a specific table via HasColumnName on a derived store object while the root request targets a different table; using entity splitting or table sharing where one participant omits a column; scaffolding reverse-engineered schemas where columns were dropped; mixing TPT/T phoenix inheritance with column exclusions.","solutions":["Inspect the property's mapping with property.GetColumnName(storeObject) before calling FindSharedStoreObjectRootProperty; if null, the property is intentionally unmapped there.","Ensure every entity sharing a table maps all properties referenced by the migration to the same store object.","Remove conflicting HasColumnName overrides or column exclusions for the failing property/table combination.","If you scaffolded the model, regenerate it after aligning the database schema with the model."],"exampleFix":"// before\nvar root = property.FindSharedStoreObjectRootProperty(storeObject);\n\n// after\nif (property.GetColumnName(storeObject) is null)\n{\n    // property intentionally unmapped on this store object; skip\n    return;\n}\nvar root = property.FindSharedStoreObjectRootProperty(storeObject);","handlingStrategy":"validation","validationCode":"if (property.GetColumnName(storeObject) is null)\n{\n    // property is not mapped on this store object; skip root-resolution\n    return;\n}\nvar root = property.FindSharedStoreObjectRootProperty(storeObject);","typeGuard":"static bool IsPropertyMappedToStore(IReadOnlyProperty p, in StoreObjectIdentifier s)\n    => !p.DeclaringType.IsMappedToJson() && p.GetColumnName(s) is not null;","tryCatchPattern":"try { var root = property.FindSharedStoreObjectRootProperty(storeObject); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"is not mapped to\"))\n{\n    // log and skip this property for the store object\n}","preventionTips":["Always confirm GetColumnName(storeObject) returns non-null before calling FindSharedStoreObjectRootProperty.","When using entity splitting or TPT, audit that each shared-table participant maps every referenced property.","After scaffold regenerations, run migration-add in dry-run to catch mapping regressions early."],"tags":["model-validation","table-sharing","column-mapping","migrations"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}