{"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/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L790-L826","documentation":"Thrown when an insert/update sproc parameter is configured as Output (or InputOutput / ReturnValue) and bound to a property that is NOT store-generated. The validator only allows non-input parameters for properties in the storeGeneratedProperties set; failing to remove the property from that set means the database will not supply a value, so an output parameter is meaningless and the model is rejected.","triggerScenarios":".HasOutputParameter(p => p.NonGeneratedColumn) on an Insert/Update sproc where NonGeneratedColumn has no ValueGenerated configuration and no database default/computed setting. The Direction is set to Output or InputOutput on a property EF considers user-supplied.","commonSituations":"Marking a regular property as an output parameter expecting the sproc to echo it back; confusing HasOutputParameter with HasParameter; flipping a column from database-generated to client-generated without updating the sproc mapping.","solutions":["Configure the property as store-generated: builder.Property(p => p.Foo).ValueGeneratedOnAdd() / .HasDefaultValueSql(...) / .HasComputedColumnSql(...) so it belongs in storeGeneratedProperties.","If the property is not store-generated, change the parameter to Input: use HasParameter(p => p.Foo) instead of HasOutputParameter(p => p.Foo).","Remove the parameter mapping entirely if the sproc does not actually populate it."],"exampleFix":"// before\nentityType.InsertUsingStoredProcedure(\"InsertOrder\",\n    sp => sp.HasOutputParameter(o => o.CustomerName)); // not store-generated\n\n// after\nentityType.InsertUsingStoredProcedure(\"InsertOrder\",\n    sp => sp.HasParameter(o => o.CustomerName));\n// or, if the DB really populates it:\n// builder.Property(o => o.CustomerName).HasDefaultValueSql(\"...\");","handlingStrategy":"validation","validationCode":"foreach (var et in model.GetEntityTypes())\n{\n    foreach (var sproc in new[] { et.GetInsertStoredProcedure(), et.GetUpdateStoredProcedure() })\n    {\n        if (sproc == null) continue;\n        foreach (var p in sproc.Parameters.Where(p => p.Direction != System.Data.ParameterDirection.Input))\n        {\n            if (p.PropertyName is string name)\n            {\n                var prop = et.FindProperty(name);\n                if (prop?.ValueGenerated == Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.Never\n                    && prop?.GetDefaultValue() == null\n                    && prop?.GetDefaultValueSql() == null\n                    && prop?.GetComputedColumnSql() == null)\n                {\n                    Console.WriteLine($\"{et.Name}.{name} is output on {sproc.Name} but not store-generated.\");\n                }\n            }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair every HasOutputParameter call with a ValueGenerated/HasDefaultValueSql/HasComputedColumnSql config on the same property.","Run EF Core's model validator explicitly in unit tests.","Document for each output parameter which DDL feature backs its generated value."],"tags":["ef-core","stored-procedures","model-validation","store-generated"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}