{"record":{"id":"030f5e3f724b92d7","repo":"dotnet/efcore","slug":"entity-type-entitytype-has-a-split-mapping-for-030f5e","errorCode":null,"errorMessage":"Entity type '{entityType}' has a split mapping for '{storeObject}', but it doesn't map any non-primary key property to it. Map at least one non-primary key property to a column on '{storeObject}'.","messagePattern":"Entity type '(.+?)' has a split mapping for '(.+?)', but it doesn't map any non-primary key property to it\\. Map at least one non-primary key property to a column on '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":2440,"sourceCode":"                    if (property.IsPrimaryKey())\n                    {\n                        throw new InvalidOperationException(\n                            RelationalStrings.EntitySplittingMissingPrimaryKey(\n                                entityType.DisplayName(), fragment.StoreObject.DisplayName()));\n                    }\n\n                    continue;\n                }\n\n                if (!property.IsPrimaryKey())\n                {\n                    propertiesFound = true;\n                }\n            }\n\n            if (!propertiesFound)\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.EntitySplittingMissingProperties(\n                        entityType.DisplayName(), fragment.StoreObject.DisplayName()));\n            }\n\n            switch (fragment.StoreObject.StoreObjectType)\n            {\n                case StoreObjectType.Table:\n                    anyTableFragments = true;\n                    break;\n                case StoreObjectType.View:\n                    anyViewFragments = true;\n                    break;\n            }\n        }\n\n        if (anyTableFragments)\n        {\n            ValidateMainMapping(entityType, StoreObjectIdentifier.Create(entityType, StoreObjectType.Table)!.Value);","sourceCodeStart":2422,"sourceCodeEnd":2458,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L2422-L2458","documentation":"After confirming the key is fully mapped, the validator checks that the split fragment carries at least one NON-primary-key property. A fragment holding only the key columns (everything else unmapped) is meaningless and indicates a misconfiguration, so EF rejects it. propertiesFound must become true during the property loop.","triggerScenarios":"A SplitToTable/MappingFragment where every non-key property resolves to a null column name on that fragment — e.g. only the PK was mapped (or implicitly inherited) and all payload columns were left on the main table or explicitly unmapped with .HasColumnName(null, fragment).","commonSituations":"Developer splits an entity but moves every payload property to the main table, leaving an empty fragment; misunderstanding entity splitting as a way to add a second key-only table; leftover fragment after refactoring.","solutions":["Map at least one non-key property to the fragment: tb.Property(c => c.SomeColumn).HasColumnName(\"SomeColumn\").","If no payload belongs on that fragment, delete the SplitToTable / MappingFragment call entirely.","Reconsider whether owned types or a one-to-one relationship express the intent better than an empty split."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .SplitToTable(\"OrderKey\", tb =>\n    {\n        tb.Property(o => o.OrderId).HasColumnName(\"OrderId\"); // only the key -> [441]\n    });\n\n// after (add a payload column, or drop the fragment)\nmodelBuilder.Entity<Order>()\n    .SplitToTable(\"OrderAudit\", tb =>\n    {\n        tb.Property(o => o.OrderId).HasColumnName(\"OrderId\");\n        tb.Property(o => o.AuditNote).HasColumnName(\"AuditNote\");\n    });","handlingStrategy":"validation","validationCode":"// After configuring a fragment, ensure at least one non-key property maps to it.\nstatic bool FragmentHasPayload(IEntityType et, StoreObjectIdentifier store)\n    => et.GetProperties().Any(p => !p.IsPrimaryKey() && p.GetColumnName(store) is not null);","typeGuard":"static bool IsValidSplitFragment(IEntityType et, StoreObjectIdentifier store)\n    => et.FindPrimaryKey()!.Properties.All(p => p.GetColumnName(store) is not null)\n       && et.GetProperties().Any(p => !p.IsPrimaryKey() && p.GetColumnName(store) is not null);","tryCatchPattern":null,"preventionTips":["Review each SplitToTable block to confirm it carries at least one payload column.","Delete fragments that hold only the key — they are invalid.","Prefer owned types for true value-object splits instead of empty entity fragments."],"tags":["entity-splitting","model-validation","relational"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}