{"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/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Extensions/RelationalPropertyExtensions.cs#L1516-L1552","documentation":"FindSharedStoreObjectRootProperty throws RelationalStrings.PropertyNotMappedToTable when property.GetColumnName(storeObject) returns null — the property is not mapped to a column on that store object (RelationalPropertyExtensions.cs:1534). This happens in table splitting / TPT / view scenarios where the property belongs to a different table than the one queried.","triggerScenarios":"Calling FindSharedStoreObjectRootProperty / FindColumnMappings with a StoreObjectIdentifier for a table the property isn't mapped to; iterating all store objects in the model and looking up each property against each.","commonSituations":"Table-splitting (multiple entities sharing a table) where some properties live on one entity's columns only; TPT hierarchies querying a base-type property against a derived table; views vs. tables mismatch.","solutions":["Guard the lookup: check property.GetColumnName(storeObject) != null before calling the shared-root lookup, or only pass store objects returned by StoreObjectIdentifier.Create(property.DeclaringType.ContainingEntityType, ...).","Resolve the property against the entity type that actually owns the column (use the declaring/derived type for the store object).","For JSON-mapped owned entities, note that JSON splitting is unsupported and returns null earlier — restructure to query the owning table."],"exampleFix":"// before\nvar so = StoreObjectIdentifier.Table(\"OrderDetails\", \"dbo\");\nvar root = orderProperty.FindSharedStoreObjectRootProperty(so); // Order.Id not on OrderDetails\n\n// after\nif (orderProperty.GetColumnName(so) is not null)\n{\n    var root = orderProperty.FindSharedStoreObjectRootProperty(so);\n}","handlingStrategy":"validation","validationCode":"var so = StoreObjectIdentifier.Table(\"Orders\", \"dbo\");\nif (property.GetColumnName(so) is not null)\n{\n    var root = property.FindSharedStoreObjectRootProperty(so);\n}","typeGuard":"static bool IsPropertyMappedTo(IReadOnlyProperty p, StoreObjectIdentifier so)\n    => p.GetColumnName(so) is not null;","tryCatchPattern":null,"preventionTips":["Check GetColumnName(storeObject) != null before shared-root lookups.","Only pass store objects the property's declaring entity is actually mapped to.","Remember JSON-split owned entities are unsupported for shared-root lookups."],"tags":["table-mapping","store-object","table-splitting","metadata"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}