{"record":{"id":"1df951b7eb90550f","repo":"dotnet/efcore","slug":"the-entity-type-entitytype-is-mapped-to-the-st","errorCode":null,"errorMessage":"The entity type '{entityType}' is mapped to the stored procedure '{sproc}', however the store-generated properties {properties} are not mapped to any output parameter or result column.","messagePattern":"The entity type '(.+?)' is mapped to the stored procedure '(.+?)', however the store-generated properties (.+?) are not mapped to any output parameter or result column\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":849,"sourceCode":"        {\n            if (resultColumn.PropertyName == null)\n            {\n                continue;\n            }\n\n            properties.Remove(resultColumn.PropertyName);\n\n            if (!storeGeneratedProperties.Remove(resultColumn.PropertyName))\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.StoredProcedureResultColumnParameterConflict(\n                        entityType.DisplayName(), resultColumn.PropertyName, storeObjectIdentifier.DisplayName()));\n            }\n        }\n\n        if (storeGeneratedProperties.Count > 0)\n        {\n            throw new InvalidOperationException(\n                RelationalStrings.StoredProcedureGeneratedPropertiesNotMapped(\n                    entityType.DisplayName(),\n                    storeObjectIdentifier.DisplayName(),\n                    storeGeneratedProperties.Values.Format()));\n        }\n\n        if (properties.Count > 0)\n        {\n            foreach (var property in properties.Values.ToList())\n            {\n                switch (storeObjectIdentifier.StoreObjectType)\n                {\n                    case StoreObjectType.InsertStoredProcedure:\n                        if ((property.ValueGenerated & ValueGenerated.OnAdd) == 0\n                            && property.GetBeforeSaveBehavior() != PropertySaveBehavior.Save)\n                        {\n                            properties.Remove(property.Name);\n                        }","sourceCodeStart":831,"sourceCodeEnd":867,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L831-L867","documentation":"Every store-generated property (identity, computed, ValueGenerated.OnAdd/OnUpdate) must have a way for EF to read the generated value back after an Insert or Update — either an output parameter or a result column. The validator at line 847-854 collects the leftover storeGeneratedProperties after processing all parameters and result columns and throws if any remain, because EF would otherwise have no way to refresh those values.","triggerScenarios":"Marking a property `.ValueGeneratedOnAdd()` / `.HasComputedColumnSql(...)` on an entity whose Insert/Update sproc is configured but does not expose a corresponding `.OutputParameter(...)` or `.ResultColumn(...)` for that property.","commonSituations":"Adding a new computed column to an entity that already uses sproc mapping and forgetting to extend the sproc config; sproc was authored before an identity column was added.","solutions":["Add an .OutputParameter(p => p.<GeneratedProp>, \"<param>\") or .ResultColumn(p => p.<GeneratedProp>, \"<col>\") to the sproc mapping for each listed property.","Update the database stored procedure to actually return those values via an OUTPUT/SELECT.","If the property is not actually generated by the database, remove the ValueGenerated/HasComputedColumnSql configuration so it is treated as client-set."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .Property(p => p.CreatedAt).ValueGeneratedOnAdd();\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(o => o\n        .Parameter(p => p.Amount, \"amt\")); // CreatedAt not read back\n\n// after\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(o => o\n        .Parameter(p => p.Amount, \"amt\")\n        .ResultColumn(p => p.CreatedAt, \"created_at\"));","handlingStrategy":"validation","validationCode":"foreach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    var generated = et.GetProperties()\n        .Where(p => p.ValueGenerated != ValueGenerated.Never).ToList();\n    foreach (var sproc in et.GetStoredProcedures())\n    {\n        if (sproc.StoreObjectType is not (StoreObjectType.InsertStoredProcedure\n                                          or StoreObjectType.UpdateStoredProcedure)) continue;\n        var mapped = new HashSet<string>(\n            sproc.Parameters.Where(p => p.Direction != ParameterDirection.Input && p.PropertyName != null)\n                           .Select(p => p.PropertyName));\n        mapped.UnionWith(sproc.ResultColumns.Where(r => r.PropertyName != null).Select(r => r.PropertyName));\n        var missing = generated.Where(p => !mapped.Contains(p.Name)).ToList();\n        if (missing.Count > 0)\n            throw new InvalidOperationException(\n                $\"{et.Name}: generated props unmapped in sproc: {string.Join(\", \", missing.Select(p => p.Name))}\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whenever you add .ValueGeneratedOnAdd/OnUpdate or .HasComputedColumnSql, immediately add the matching .OutputParameter or .ResultColumn.","Keep the database sproc and the EF config in the same commit so they stay aligned.","Write a test that calls FinalizeModel() to surface this in CI rather than at first request."],"tags":["ef-core","stored-procedures","model-validation","store-generated"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}