{"record":{"id":"eabc9557fa89c01f","repo":"dotnet/efcore","slug":"the-property-entitytype-property-is-mapped-t-eabc95","errorCode":null,"errorMessage":"The property '{entityType}.{property}' is mapped to a result column of the stored procedure '{sproc}', but it is also mapped to an output parameter. A store-generated property can only be mapped to one of these.","messagePattern":"The property '(.+?)\\.(.+?)' is mapped to a result column of the stored procedure '(.+?)', but it is also mapped to an output parameter\\. A store-generated property can only be mapped to one of these\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":841,"sourceCode":"                    break;\n                default:\n                    Check.DebugFail(\"Unexpected stored procedure type: \" + storeObjectIdentifier.StoreObjectType);\n                    break;\n            }\n        }\n\n        foreach (var resultColumn in sproc.ResultColumns)\n        {\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            {","sourceCodeStart":823,"sourceCodeEnd":859,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L823-L859","documentation":"A store-generated property can be read back from a stored procedure via exactly one mechanism — either an output parameter or a result column. The validator at line 839-844 throws when a result column references a property that was already removed from the storeGenerated set by an earlier output parameter (or is not store-generated at all). Mapping the same generated value to both creates ambiguity about which source EF should use to populate the property after save.","triggerScenarios":"On an Insert/Update sproc, calling both `.OutputParameter(p => p.Id, ...)` and `.ResultColumn(p => p.Id, ...)` for the same property. The output-parameter handler removes the property from storeGeneratedProperties first, so when the result column tries to remove it again the set lookup fails.","commonSituations":"Translating a sproc that uses both an OUTPUT clause and a RETURN/SELECT by accident; merging two config snippets that each added a different read-back mapping for the identity column.","solutions":["Pick one read-back mechanism: keep the OutputParameter mapping and remove the ResultColumn (or vice-versa).","Prefer OutputParameter when the sproc returns the value via an OUT param; prefer ResultColumn when the sproc returns a result set row.","Audit the sproc mapping for any property that appears in both .OutputParameter() and .ResultColumn() calls."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(o => o\n        .OutputParameter(p => p.Id, \"new_id\")\n        .ResultColumn(p => p.Id, \"id\"));   // duplicate read-back\n\n// after - keep only the output parameter\nmodelBuilder.Entity<Order>()\n    .InsertStoredProcedure(o => o\n        .OutputParameter(p => p.Id, \"new_id\"));","handlingStrategy":"validation","validationCode":"foreach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    foreach (var sproc in et.GetStoredProcedures())\n    {\n        var outputProps = sproc.Parameters\n            .Where(p => p.Direction != ParameterDirection.Input && p.PropertyName != null)\n            .Select(p => p.PropertyName).ToHashSet();\n        foreach (var rc in sproc.ResultColumns)\n        {\n            if (rc.PropertyName != null && outputProps.Contains(rc.PropertyName))\n            {\n                throw new InvalidOperationException(\n                    $\"Property '{rc.PropertyName}' on {et.Name} mapped to both output param and result column.\");\n            }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For each generated property choose exactly one read-back mechanism: OutputParameter XOR ResultColumn.","Audit sproc builders for any property name appearing in both .OutputParameter() and .ResultColumn() calls.","Prefer result columns when the sproc returns a result set; output parameters when it uses OUT args."],"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"}