{"record":{"id":"75fcef21dd6ddf4a","repo":"dotnet/efcore","slug":"the-property-entitytype-property-is-mapped-t-75fcef","errorCode":null,"errorMessage":"The property '{entityType}.{property}' is mapped to an output parameter of the stored procedure '{sproc}', but it is not configured as store-generated. Either configure it as store-generated or don't configure the parameter as output.","messagePattern":"The property '(.+?)\\.(.+?)' is mapped to an output parameter of the stored procedure '(.+?)', but it is not configured as store-generated\\. Either configure it as store-generated or don't configure the parameter as output\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":808,"sourceCode":"            }\n\n            switch (storeObjectIdentifier.StoreObjectType)\n            {\n                case StoreObjectType.InsertStoredProcedure:\n                case StoreObjectType.UpdateStoredProcedure:\n                    if (parameter.Direction != ParameterDirection.Input\n                        && !storeGeneratedProperties.Remove(property!.Name))\n                    {\n                        if (sproc.Parameters.Any(p => p.PropertyName == property.Name\n                                && p.ForOriginalValue != parameter.ForOriginalValue\n                                && p.Direction != ParameterDirection.Input))\n                        {\n                            throw new InvalidOperationException(\n                                RelationalStrings.StoredProcedureOutputParameterConflict(\n                                    entityType.DisplayName(), parameter.PropertyName, storeObjectIdentifier.DisplayName()));\n                        }\n\n                        throw new InvalidOperationException(\n                            RelationalStrings.StoredProcedureOutputParameterNotGenerated(\n                                entityType.DisplayName(), parameter.PropertyName, storeObjectIdentifier.DisplayName()));\n                    }\n\n                    break;\n                case StoreObjectType.DeleteStoredProcedure:\n                    if (!property!.IsPrimaryKey()\n                        && !property.IsConcurrencyToken)\n                    {\n                        throw new InvalidOperationException(\n                            RelationalStrings.StoredProcedureDeleteNonKeyProperty(\n                                entityType.DisplayName(), parameter.PropertyName, storeObjectIdentifier.DisplayName()));\n                    }\n\n                    break;\n                default:\n                    Check.DebugFail(\"Unexpected stored procedure type: \" + storeObjectIdentifier.StoreObjectType);\n                    break;","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L790-L826","documentation":"Thrown during model validation when an Insert/Update stored procedure maps a property to an output (or input-output) parameter, but that property is not configured as store-generated (ValueGenerated). EF uses output parameters to read back values the database generates (e.g. identity/computed columns), so an output parameter on a non-generated property is meaningless and almost always a configuration mistake. The validator at line 796-811 checks `parameter.Direction != ParameterDirection.Input` and requires the property be in the storeGenerated set.","triggerScenarios":"Calling `.InsertStoredProcedure(...)` or `.UpdateStoredProcedure(...)` on an entity and using `.OutputParameter()` / `.InputOutputParameter()` for a property that has no `.ValueGeneratedOnAdd()` / `.ValueGeneratedOnUpdate()` / `.HasComputedColumnSql()` configuration. The check fires for InsertStoredProcedure and UpdateStoredProcedure store object types only.","commonSituations":"Developer maps every column to an output parameter by habit; copy-pasting a parameter list from a SQL sproc signature into EF config without marking computed/identity columns; switching a property from database-generated to client-set but forgetting to drop the output parameter mapping.","solutions":["Mark the property as store-generated, e.g. propertyBuilder.ValueGeneratedOnAdd() or .HasComputedColumnSql(\"...\").","If the value is not database-generated, change the parameter direction to input-only by using .Parameter(...) instead of .OutputParameter(...)/.InputOutputParameter(...).","Remove the parameter mapping entirely if the sproc does not actually return that value."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(o => o\n        .Parameter(p => p.Status, \"status\")\n        .OutputParameter(p => p.Status, \"status_out\")); // Status is not store-generated\n\n// after - make it input only since Status is set by the client\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(o => o\n        .Parameter(p => p.Status, \"status\"));\n// OR mark it generated:\n// modelBuilder.Entity<Order>().Property(p => p.Status).ValueGeneratedOnAdd();","handlingStrategy":"validation","validationCode":"// Before finalizing the model, ensure each output/inputOutput parameter\n// on an Insert/Update sproc targets a store-generated property.\nforeach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    foreach (var sproc in et.GetStoredProcedures())\n    {\n        if (sproc.StoreObjectType is StoreObjectType.InsertStoredProcedure\n                                  or StoreObjectType.UpdateStoredProcedure)\n        {\n            var generated = et.GetProperties()\n                .Where(p => p.ValueGenerated != ValueGenerated.Never)\n                .Select(p => p.Name).ToHashSet();\n            foreach (var param in sproc.Parameters)\n            {\n                if (param.Direction != ParameterDirection.Input\n                    && param.PropertyName is string name\n                    && !generated.Contains(name))\n                {\n                    throw new InvalidOperationException(\n                        $\"Output param '{param.Name}' on {et.Name} maps non-generated property '{name}'.\");\n                }\n            }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only map output/inputOutput parameters for properties explicitly marked ValueGeneratedOnAdd/OnUpdate or HasComputedColumnSql.","Review the database sproc signature: OUT params should correspond 1:1 to generated columns.","Run a model-validation unit test (model.FinalizeModel()) in CI to catch this before runtime."],"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"}