{"record":{"id":"7d2738fd52261036","repo":"dotnet/efcore","slug":"the-property-entitytype-property-is-mapped-t-7d2738","errorCode":null,"errorMessage":"The property '{entityType}.{property}' is mapped to a result column of the stored procedure '{sproc}', but store-generated values are not supported for Delete stored procedures.","messagePattern":"The property '(.+?)\\.(.+?)' is mapped to a result column of the stored procedure '(.+?)', but store-generated values are not supported for Delete stored procedures\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":689,"sourceCode":"            if (resultColumn.PropertyName == null)\n            {\n                continue;\n            }\n\n            switch (storeObjectIdentifier.StoreObjectType)\n            {\n                case StoreObjectType.InsertStoredProcedure:\n                case StoreObjectType.UpdateStoredProcedure:\n                    if (!storeGeneratedProperties.ContainsKey(property.Name))\n                    {\n                        throw new InvalidOperationException(\n                            RelationalStrings.StoredProcedureResultColumnNotGenerated(\n                                entityType.DisplayName(), resultColumn.PropertyName, storeObjectIdentifier.DisplayName()));\n                    }\n\n                    break;\n                case StoreObjectType.DeleteStoredProcedure:\n                    throw new InvalidOperationException(\n                        RelationalStrings.StoredProcedureResultColumnDelete(\n                            entityType.DisplayName(), resultColumn.PropertyName, storeObjectIdentifier.DisplayName()));\n                default:\n                    Check.DebugFail(\"Unexpected stored procedure type: \" + storeObjectIdentifier.StoreObjectType);\n                    break;\n            }\n        }\n\n        var originalValueProperties = new Dictionary<string, IProperty>(properties);\n        var parameterNames = new HashSet<string>();\n        foreach (var parameter in sproc.Parameters)\n        {\n            IProperty? property = null;\n            if (parameter.PropertyName != null)\n            {\n                if (parameter.ForOriginalValue == true)\n                {\n                    if (!originalValueProperties.TryGetAndRemove(parameter.PropertyName, out property))","sourceCodeStart":671,"sourceCodeEnd":707,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L671-L707","documentation":"Thrown in the result-column switch when storeObjectIdentifier.StoreObjectType is DeleteStoredProcedure (RelationalModelValidator.cs:688-691). Delete sprocs should not return values; nothing is store-generated on delete. Any HasResultColumn on a delete sproc triggers this — there is no valid scenario.","triggerScenarios":"Configuring .DeleteUsingStoredProcedure(... sp => sp.HasResultColumn(x => x.Something)). Even one result column on a delete sproc throws unconditionally.","commonSituations":"Copy-pasting an insert sproc block to a delete sproc and forgetting to strip result columns; misunderstanding that delete sprocs don't return affected rows back into entities.","solutions":["Remove all HasResultColumn(...) calls from the delete-stored-procedure configuration.","If the DB sproc returns a rowcount or status, ignore it client-side — do not map it as a result column.","Use OutputParameter(...) if you need a scalar return value from the delete sproc."],"exampleFix":"// before\nmodelBuilder.Entity<Customer>()\n    .DeleteUsingStoredProcedure(\"dbo.CustomerDelete\", sp =>\n    {\n        sp.HasOriginalValueParameter(c => c.Id);\n        sp.HasResultColumn(c => c.Id); // throws — delete sproc has no result\n    });\n\n// after\nmodelBuilder.Entity<Customer>()\n    .DeleteUsingStoredProcedure(\"dbo.CustomerDelete\", sp =>\n    {\n        sp.HasOriginalValueParameter(c => c.Id);\n    });","handlingStrategy":"validation","validationCode":"foreach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    var delete = et.GetDeleteStoredProcedure();\n    if (delete is not null && delete.ResultColumns.Count > 0)\n        throw new InvalidOperationException($\"Delete sproc '{delete.GetStoreIdentifier().DisplayName}' on '{et.Name}' must not have result columns.\");\n}","typeGuard":null,"tryCatchPattern":"try { _ = ctx.Model; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"not supported for Delete stored procedures\"))\n{\n    logger.LogError(\"Remove all HasResultColumn calls from the delete sproc. {Msg}\", ex.Message);\n    throw;\n}","preventionTips":["Never call HasResultColumn inside a DeleteUsingStoredProcedure block.","Use OutputParameter for scalar return values from delete sprocs.","Review delete sproc configs as a distinct step — they should only bind original-value parameters."],"tags":["efcore","relational","stored-procedure","result-column","delete","model-validation"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}