{"record":{"id":"24e92b3cf840fc42","repo":"dotnet/efcore","slug":"entity-type-entitytype-has-a-split-mapping-for","errorCode":null,"errorMessage":"Entity type '{entityType}' has a split mapping for '{storeObject}', but it also participates in an entity type hierarchy. Split mappings are not supported for hierarchies.","messagePattern":"Entity type '(.+?)' has a split mapping for '(.+?)', but it also participates in an entity type hierarchy\\. Split mappings are not supported for hierarchies\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":2378,"sourceCode":"    /// <summary>\n    ///     Validates the mapping fragments for an entity type.\n    /// </summary>\n    /// <param name=\"entityType\">The entity type to validate.</param>\n    /// <param name=\"logger\">The logger to use.</param>\n    protected virtual void ValidateMappingFragment(\n        IEntityType entityType,\n        IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)\n    {\n        var fragments = EntityTypeMappingFragment.Get(entityType);\n        if (fragments == null)\n        {\n            return;\n        }\n\n        if (entityType.BaseType != null\n            || entityType.GetDirectlyDerivedTypes().Any())\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.EntitySplittingHierarchy(entityType.DisplayName(), fragments.First().StoreObject.DisplayName()));\n        }\n\n        var anyTableFragments = false;\n        var anyViewFragments = false;\n        foreach (var fragment in fragments)\n        {\n            var mainStoreObject = StoreObjectIdentifier.Create(entityType, fragment.StoreObject.StoreObjectType);\n            if (mainStoreObject == null)\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.EntitySplittingUnmappedMainFragment(\n                        entityType.DisplayName(), fragment.StoreObject.DisplayName(), fragment.StoreObject.StoreObjectType));\n            }\n\n            if (fragment.StoreObject == mainStoreObject)\n            {\n                throw new InvalidOperationException(","sourceCodeStart":2360,"sourceCodeEnd":2396,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L2360-L2396","documentation":"Thrown in the entity-splitting validator when an entity type has EntityTypeMappingFragment entries (split mappings) and also participates in an inheritance hierarchy — i.e. it has a BaseType or has directly derived types. Splitting (mapping one entity across multiple tables) is not supported for any type inside a hierarchy.","triggerScenarios":"Calling SplitToTable/EntityTypeMappingFragment configuration on an entity that has a base type or that other types derive from. The check is entityType.BaseType != null || entityType.GetDirectlyDerivedTypes().Any().","commonSituations":"Trying to split a base entity that is inherited from; combining table splitting with inheritance; refactor that introduced a base type after splitting was configured.","solutions":["Remove the split mapping (SplitToTable/fragments) from any type that is in a hierarchy.","Remove the inheritance relationship so the type is standalone before splitting it.","Move the columns into the main table instead of splitting when the type must stay in a hierarchy."],"exampleFix":"// before\nmodelBuilder.Entity<Customer>().SplitToTable(\"CustomerExtras\", t =>\n    t.Property(c => c.Notes));\n// SpecialCustomer : Customer -> throws 436\n\n// after - do not split a type that is in a hierarchy\n// either remove the split, or remove the inheritance\nmodelBuilder.Entity<Customer>().ToTable(\"Customers\");\n// put Notes in Customers, or split a non-hierarchical type","handlingStrategy":"validation","validationCode":"foreach (var entityType in modelBuilder.Model.GetEntityTypes())\n{\n    var hasFragments = EntityTypeMappingFragment.Get(entityType) != null;\n    if (!hasFragments) continue;\n    if (entityType.BaseType != null || entityType.GetDirectlyDerivedTypes().Any())\n        throw new InvalidOperationException($\"{entityType.DisplayName()} uses split mapping but is in a hierarchy; splitting is unsupported for hierarchies.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine SplitToTable with inheritance.","Before adding a base type to an entity, remove any SplitToTable configuration.","Add a model test asserting no split entity participates in a hierarchy."],"tags":["ef-core","model-validation","mapping","table-splitting","inheritance"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}