{"record":{"id":"180d39cdf45df585","repo":"dotnet/efcore","slug":"the-property-entitytype-property-is-mapped-t-180d39","errorCode":null,"errorMessage":"The property '{entityType}.{property}' is mapped to an output parameter of the stored procedure '{sproc}', but it is also mapped to an output original value output parameter. A store-generated property can only be mapped to one output parameter.","messagePattern":"The property '(.+?)\\.(.+?)' is mapped to an output parameter of the stored procedure '(.+?)', but it is also mapped to an output original value output parameter\\. A store-generated property can only be mapped to one output parameter\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":803,"sourceCode":"            }\n\n            if (parameter.PropertyName == null)\n            {\n                continue;\n            }\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                    }","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L785-L821","documentation":"Thrown when a store-generated property is mapped to two output parameters that differ by original-value flag (one current-value output and one original-value output). A single store-generated property can only map to one output parameter. The validator detects another output parameter for the same property with a different ForOriginalValue value.","triggerScenarios":"Both .HasOutputParameter(\"Version\") and .HasOriginalValueParameter(\"Version\") (with output direction) on the same store-generated property; double-binding a computed column as both current and original output.","commonSituations":"Trying to capture both the new and old generated value of one property; over-mapping a single store-generated column.","solutions":["Remove one of the output parameter mappings so the property maps to exactly one output parameter.","Keep the current-value output parameter and drop the original-value one (or vice-versa)."],"exampleFix":"// before\nsp.HasOutputParameter(\"Version\");\nsp.HasOriginalValueParameter(\"Version\"); // output + original output\n\n// after\nsp.HasOutputParameter(\"Version\");","handlingStrategy":"validation","validationCode":"foreach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    foreach (var s in new[] { et.GetInsertStoredProcedure(), et.GetUpdateStoredProcedure() }.Where(s => s != null))\n    {\n        var outputs = s.Parameters.Where(p => p.PropertyName != null && p.Direction != System.Data.ParameterDirection.Input);\n        var dup = outputs.GroupBy(p => p.PropertyName).Where(g => g.Select(x => x.ForOriginalValue).Distinct().Count() > 1);\n        if (dup.Any()) throw new InvalidOperationException($\"Property {dup.First().Key} mapped to multiple output params on {s.GetStoreIdentifier().Name}\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try { _ = ctx.Model; } catch (InvalidOperationException ex) when (ex.Message.Contains(\"mapped to an output parameter\") && ex.Message.Contains(\"output original value output parameter\")) { /* remove one of the conflicting output parameter mappings */ }","preventionTips":["Map each store-generated property to exactly one output parameter.","Avoid mixing HasOutputParameter and HasOriginalValueParameter(output) on the same property."],"tags":["ef-core","stored-procedures","output-parameters","store-generated","model-validation"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}