{"record":{"id":"d0f9904921ca1d97","repo":"dotnet/efcore","slug":"the-property-entitytype-property-is-mapped-t","errorCode":null,"errorMessage":"The property '{entityType}.{property}' is mapped to a result column of the stored procedure '{sproc}', but it is not configured as store-generated.","messagePattern":"The property '(.+?)\\.(.+?)' is mapped to a result column of the stored procedure '(.+?)', but it is not configured as store-generated\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":682,"sourceCode":"            if (!resultColumnNames.Add(resultColumn.Name))\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.StoredProcedureDuplicateResultColumnName(\n                        resultColumn.Name, storeObjectIdentifier.DisplayName()));\n            }\n\n            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)","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L664-L700","documentation":"Thrown in the result-column switch for Insert and Update sprocs when the bound property is not in storeGeneratedProperties (RelationalModelValidator.cs:678-685). storeGeneratedProperties is computed at lines 633-640 as properties with ValueGenerated.OnAdd (insert) or ValueGenerated.OnUpdate (update). A result column implies the DB produces the value, so the property must be marked store-generated.","triggerScenarios":"Adding .HasResultColumn(x => x.UpdatedAt) to an Update sproc without marking AtUpdatedAt as ValueGenerated.OnUpdate (or .HasDatabaseGeneratedOption). Or binding a normal property as a result column expecting EF to read it back, without configuring value generation.","commonSituations":"Treating a regular column as a result column so EF reads it after save; forgetting .ValueGeneratedOnAdd()/OnUpdate() on identity/computed/timestamp columns when moving to sproc mapping.","solutions":["Mark the property store-generated to match the sproc type: .ValueGeneratedOnAdd() for insert result columns, .ValueGeneratedOnUpdate() (or .ValueGeneratedOnAddOrUpdate()) for update.","If the property isn't actually DB-generated, remove the HasResultColumn binding and pass it as an input parameter instead.","For computed columns use .ValueGeneratedOnAddOrUpdate() so they appear in both store-generated sets."],"exampleFix":"// before\nmodelBuilder.Entity<Customer>()\n    .InsertUsingStoredProcedure(\"dbo.CustomerInsert\", sp =>\n    {\n        sp.HasParameter(c => c.Name);\n        sp.HasResultColumn(c => c.CreatedAt); // not marked store-generated\n    });\n\n// after\nmodelBuilder.Entity<Customer>(b =>\n{\n    b.Property(c => c.CreatedAt).ValueGeneratedOnAdd();\n    b.InsertUsingStoredProcedure(\"dbo.CustomerInsert\", sp =>\n    {\n        sp.HasParameter(c => c.Name);\n        sp.HasResultColumn(c => c.CreatedAt);\n    });\n});","handlingStrategy":"validation","validationCode":"foreach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    var insert = et.GetInsertStoredProcedure();\n    var update = et.GetUpdateStoredProcedure();\n    if (insert is not null)\n    {\n        var gen = et.GetProperties().Where(p => p.ValueGenerated.HasFlag(ValueGenerated.OnAdd)).Select(p => p.Name).ToHashSet();\n        foreach (var rc in insert.ResultColumns.Where(c => c.PropertyName is not null))\n            if (!gen.Contains(rc.PropertyName))\n                throw new InvalidOperationException($\"Insert sproc result column '{rc.PropertyName}' on '{et.Name}' must be ValueGeneratedOnAdd.\");\n    }\n    if (update is not null)\n    {\n        var gen = et.GetProperties().Where(p => p.ValueGenerated.HasFlag(ValueGenerated.OnUpdate)).Select(p => p.Name).ToHashSet();\n        foreach (var rc in update.ResultColumns.Where(c => c.PropertyName is not null))\n            if (!gen.Contains(rc.PropertyName))\n                throw new InvalidOperationException($\"Update sproc result column '{rc.PropertyName}' on '{et.Name}' must be ValueGeneratedOnUpdate.\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try { _ = ctx.Model; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"not configured as store-generated\"))\n{\n    logger.LogError(\"Result-column property must be store-generated. {Msg}\", ex.Message);\n    throw;\n}","preventionTips":["Mark identity columns .ValueGeneratedOnAdd() and computed columns .ValueGeneratedOnAddOrUpdate() before binding them as result columns.","Treat HasResultColumn as 'value produced by the DB' — never bind plain input columns to it.","Validate the model after switching a property's value-generated setting."],"tags":["efcore","relational","stored-procedure","result-column","store-generated","value-generated","model-validation"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}