{"record":{"id":"99820eedac8d12d2","repo":"dotnet/efcore","slug":"the-entity-type-entitytype-is-mapped-to-the-st-99820e","errorCode":null,"errorMessage":"The entity type '{entityType}' is mapped to the stored procedure '{sproc}', however the properties {properties} are not mapped to any parameter or result column.","messagePattern":"The entity type '(.+?)' is mapped to the stored procedure '(.+?)', however the properties (.+?) are not mapped to any parameter or result column\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":901,"sourceCode":"                        {\n                            properties.Remove(property.Name);\n                        }\n\n                        break;\n                }\n            }\n\n            foreach (var property in properties.Keys.ToList())\n            {\n                if (!originalValueProperties.ContainsKey(property))\n                {\n                    properties.Remove(property);\n                }\n            }\n\n            if (properties.Count > 0)\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.StoredProcedurePropertiesNotMapped(\n                        entityType.DisplayName(),\n                        storeObjectIdentifier.DisplayName(),\n                        properties.Values.Format()));\n            }\n        }\n\n        if (sproc.IsRowsAffectedReturned\n            || sproc.FindRowsAffectedParameter() != null\n            || sproc.FindRowsAffectedResultColumn() != null)\n        {\n            if (storeObjectIdentifier.StoreObjectType == StoreObjectType.InsertStoredProcedure)\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.StoredProcedureRowsAffectedForInsert(\n                        storeObjectIdentifier.DisplayName()));\n            }\n","sourceCodeStart":883,"sourceCodeEnd":919,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L883-L919","documentation":"Thrown when, after sproc parameter processing, the `properties` set (entity properties that EF expects to send to the sproc) still has entries that are neither mappable as current-value parameters nor original-value parameters. Each remaining property must have been consumed by a HasParameter/HasOriginalValueParameter call; otherwise the model is incomplete and SaveChanges would silently skip writing data.","triggerScenarios":"An entity has properties that the validator cannot reconcile with any sproc parameter, result column, or original-value slot. Specifically: on Update sproc, a property that is a non-key, non-concurrency-token, non-OnUpdate-generated, non-Save-after-save-behavior property but is still expected to be persisted; on Insert sproc, a non-OnAdd, non-Save-before-save-behavior property; or any property the developer expects the sproc to handle but did not map.","commonSituations":"Adding a new property to the entity and forgetting to add the sproc parameter; mapping only some columns of a table to the sproc; mixing TPH inheritance where derived properties are not surfaced in the sproc.","solutions":["Add .HasParameter(p => p.TheProperty) (or HasOriginalValueParameter for concurrency tokens) to the relevant sproc mapping for every property listed in the error.","If the property should not be persisted by this sproc (e.g. computed-only, never written), configure it so: .ValueGeneratedOnAddOrUpdate() and AfterSaveBehavior.Ignore / BeforeSaveBehavior.Ignore as appropriate so the validator removes it from the expected set.","Verify IsRequired/IsRequiredWhenSaved semantics — a property declared on the entity but unassigned by the user may still be required by the sproc mapping."],"exampleFix":"// before\nentityType.UpdateUsingStoredProcedure(\"UpdateOrder\",\n    sp =>\n    {\n        sp.HasParameter(o => o.OrderId);\n        // forgot Status -> listed as unmapped\n    });\n\n// after\nentityType.UpdateUsingStoredProcedure(\"UpdateOrder\",\n    sp =>\n    {\n        sp.HasParameter(o => o.OrderId);\n        sp.HasParameter(o => o.Status);\n    });","handlingStrategy":"validation","validationCode":"// After building the model, log any property EF considers unmapped for the sproc.\nforeach (var et in model.GetEntityTypes())\n{\n    foreach (var sproc in new[] { et.GetInsertStoredProcedure(), et.GetUpdateStoredProcedure(), et.GetDeleteStoredProcedure() })\n    {\n        if (sproc == null) continue;\n        var mapped = sproc.Parameters.Select(p => p.PropertyName).Where(n => n != null).ToHashSet();\n        foreach (var prop in et.GetProperties())\n        {\n            if (!mapped.Contains(prop.Name)\n                && (et.GetTableName() != null || prop.IsPrimaryKey() || prop.IsConcurrencyToken))\n            {\n                // Heuristic: only flag properties the validator would expect.\n                Console.WriteLine($\"{et.Name}.{prop.Name} not present on {sproc.Name}.\");\n            }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When you add a new property to an entity, audit every sproc mapping (insert/update/delete) for that entity.","Centralize sproc mapping per entity in one file so omissions are visible.","Keep an integration test that asserts the model finalizes without throwing."],"tags":["ef-core","stored-procedures","model-validation"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}