dotnet/efcore · error · InvalidOperationException
Entity type ' ' has a split mapping for ' ', but it also…
Error message
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. What it means
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.
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.
Example fix
// before
modelBuilder.Entity<Customer>().SplitToTable("CustomerExtras", t =>
t.Property(c => c.Notes));
// SpecialCustomer : Customer -> throws 436
// after - do not split a type that is in a hierarchy
// either remove the split, or remove the inheritance
modelBuilder.Entity<Customer>().ToTable("Customers");
// put Notes in Customers, or split a non-hierarchical type Defensive patterns
Strategy: validation
Validate before calling
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
var hasFragments = EntityTypeMappingFragment.Get(entityType) != null;
if (!hasFragments) continue;
if (entityType.BaseType != null || entityType.GetDirectlyDerivedTypes().Any())
throw new InvalidOperationException($"{entityType.DisplayName()} uses split mapping but is in a hierarchy; splitting is unsupported for hierarchies.");
} Prevention
- 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.
When it happens
Trigger: 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().
Common situations: 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.
Related errors
- The entity type ' ' is mapped to ' '. However the principal…
- The entity type ' ' is mapped to ' '. However one of its…
- Both ' ' and ' ' are explicitly mapped to the stored…
- Both ' ' and ' ' are mapped to the table ' '. All the…
- Both ' ' and ' ' are mapped to the stored procedure ' '…
AI-assisted analysis of dotnet/efcore@3a2006ef56 (2026-08-11).
Data as JSON: /api/errors/24e92b3cf840fc42.
Report an issue: GitHub.
Appendix: source
Thrown at src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs:2378
/// <summary>
/// Validates the mapping fragments for an entity type.
/// </summary>
/// <param name="entityType">The entity type to validate.</param>
/// <param name="logger">The logger to use.</param>
protected virtual void ValidateMappingFragment(
IEntityType entityType,
IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)
{
var fragments = EntityTypeMappingFragment.Get(entityType);
if (fragments == null)
{
return;
}
if (entityType.BaseType != null
|| entityType.GetDirectlyDerivedTypes().Any())
{
throw new InvalidOperationException(
RelationalStrings.EntitySplittingHierarchy(entityType.DisplayName(), fragments.First().StoreObject.DisplayName()));
}
var anyTableFragments = false;
var anyViewFragments = false;
foreach (var fragment in fragments)
{
var mainStoreObject = StoreObjectIdentifier.Create(entityType, fragment.StoreObject.StoreObjectType);
if (mainStoreObject == null)
{
throw new InvalidOperationException(
RelationalStrings.EntitySplittingUnmappedMainFragment(
entityType.DisplayName(), fragment.StoreObject.DisplayName(), fragment.StoreObject.StoreObjectType));
}
if (fragment.StoreObject == mainStoreObject)
{
throw new InvalidOperationException(View on GitHub (pinned to 3a2006ef56)