{"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/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L883-L919","documentation":"After filtering out properties that are non-saveable, non-generated, or only relevant for original-value concurrency tokens, any remaining properties must be mapped to a parameter or result column of the stored procedure. The validator at line 899-906 throws for the surviving set, meaning these are concrete properties EF expects to persist or read but the sproc mapping does not cover them.","triggerScenarios":"Mapping an entity to an Insert/Update/Delete sproc but omitting `.Parameter(...)` for one or more writable properties. The filtering at lines 860-888 only removes properties that are genuinely irrelevant (e.g. not saveable in that direction); anything left is required.","commonSituations":"Adding a new required column to an entity and not updating the sproc config; switching an entity to sproc mapping and missing a property in the manual parameter list (sprocs do not auto-map columns the way tables do).","solutions":["Add .Parameter(p => p.<MissingProp>, \"<param>\") for each listed property in the matching Insert/Update/Delete sproc.","Update the database stored procedure signature to accept the new parameter.","If the property should not be persisted by this sproc, configure its BeforeSaveBehavior/AfterSaveBehavior to Ignore so the validator filters it out."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .UpdateStoredProcedure(o => o\n        .Parameter(p => p.Amount, \"amt\")); // Status missing\n\n// after\nmodelBuilder.Entity<Order>()\n    .UpdateStoredProcedure(o => o\n        .Parameter(p => p.Amount, \"amt\")\n        .Parameter(p => p.Status, \"status\"));","handlingStrategy":"validation","validationCode":"foreach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    foreach (var sproc in et.GetStoredProcedures())\n    {\n        var mappedParams = sproc.Parameters.Where(p => p.PropertyName != null).Select(p => p.PropertyName).ToHashSet();\n        var mappedCols = sproc.ResultColumns.Where(r => r.PropertyName != null).Select(r => r.PropertyName).ToHashSet();\n        foreach (var prop in et.GetProperties())\n        {\n            bool saveable = sproc.StoreObjectType switch\n            {\n                StoreObjectType.InsertStoredProcedure =>\n                    prop.GetBeforeSaveBehavior() == PropertySaveBehavior.Save\n                    || (prop.ValueGenerated & ValueGenerated.OnAdd) != 0,\n                StoreObjectType.UpdateStoredProcedure =>\n                    prop.IsPrimaryKey() || prop.IsConcurrencyToken\n                    || (prop.ValueGenerated & ValueGenerated.OnUpdate) != 0\n                    || prop.GetAfterSaveBehavior() == PropertySaveBehavior.Save,\n                StoreObjectType.DeleteStoredProcedure => prop.IsPrimaryKey() || prop.IsConcurrencyToken,\n                _ => false\n            };\n            if (saveable && !mappedParams.Contains(prop.Name) && !mappedCols.Contains(prop.Name))\n            {\n                // potential gap — investigate and add .Parameter(...) mapping\n            }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When adding a new property to an entity that uses sproc mapping, add the .Parameter(...) call in the same change.","Remember sproc mappings are explicit — EF does not auto-map columns the way it does for tables.","Diff the entity properties against the sproc parameter list as part of code review."],"tags":["ef-core","stored-procedures","model-validation","configuration"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}