{"record":{"id":"c2f4cd092f9c1dd5","repo":"dotnet/efcore","slug":"no-property-named-property-found-on-the-entity","errorCode":null,"errorMessage":"No property named '{property}' found on the entity type '{entityType}' corresponding to the result column on the stored procedure '{sproc}'.","messagePattern":"No property named '(.+?)' found on the entity type '(.+?)' corresponding to the result column on the stored procedure '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":659,"sourceCode":"\n        if (mappingStrategy == RelationalAnnotationNames.TptMappingStrategy\n            && storeObjectIdentifier.StoreObjectType == StoreObjectType.InsertStoredProcedure\n            && entityType.BaseType?.GetInsertStoredProcedure() != null)\n        {\n            foreach (var property in primaryKey.Properties)\n            {\n                storeGeneratedProperties.Remove(property.Name);\n            }\n        }\n\n        var resultColumnNames = new HashSet<string>();\n        foreach (var resultColumn in sproc.ResultColumns)\n        {\n            IProperty? property = null!;\n            if (resultColumn.PropertyName != null\n                && !properties.TryGetValue(resultColumn.PropertyName, out property))\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.StoredProcedureResultColumnNotFound(\n                        resultColumn.PropertyName, entityType.DisplayName(), storeObjectIdentifier.DisplayName()));\n            }\n\n            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            {","sourceCodeStart":641,"sourceCodeEnd":677,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L641-L677","documentation":"Thrown in the result-column loop of ValidateSproc when sproc.ResultColumns has an entry whose PropertyName is non-null but no property with that name exists on the entity (RelationalModelValidator.cs:656-662). The lookup uses the properties dictionary (declared + hierarchy properties per mapping strategy). The column-to-property binding must reference a real property.","triggerScenarios":"Calling .HasResultColumn(x => x.NonExistent) or .HasResultColumn(\"OldName\") inside a sproc configuration after the property was renamed or removed. Or scaffolding against an older DB schema whose column names no longer match current entity properties.","commonSituations":"Renaming a property (e.g., CreatedAt -> CreatedOn) without updating the result-column binding; typo in the string-based HasResultColumn(\"CreatdAt\"); merging two entity types and leaving dangling column references.","solutions":["Update the result-column binding to an existing property: sp.HasResultColumn(x => x.CurrentProperty) or sp.HasResultColumn(\"CurrentProperty\").","If the column has no matching property, configure it as an unbound result column (omit the property name) or remove the HasResultColumn call.","Re-scaffold or regenerate the sproc configuration after the entity refactor to catch dangling references."],"exampleFix":"// before\nmodelBuilder.Entity<Customer>()\n    .InsertUsingStoredProcedure(\"dbo.CustomerInsert\", sp =>\n    {\n        sp.HasResultColumn(\"CreatedAt\"); // property renamed to CreatedOn\n    });\n\n// after\nmodelBuilder.Entity<Customer>()\n    .InsertUsingStoredProcedure(\"dbo.CustomerInsert\", sp =>\n    {\n        sp.HasResultColumn(c => c.CreatedOn);\n    });","handlingStrategy":"validation","validationCode":"// After configuring each sproc, verify every bound result column resolves to a property.\nforeach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    var propNames = et.GetProperties().Select(p => p.Name).ToHashSet();\n    foreach (var sproc in new[] { et.GetInsertStoredProcedure(), et.GetUpdateStoredProcedure(), et.GetDeleteStoredProcedure() })\n    {\n        if (sproc is null) continue;\n        foreach (var rc in sproc.ResultColumns)\n            if (rc.PropertyName is not null && !propNames.Contains(rc.PropertyName))\n                throw new InvalidOperationException($\"Sproc '{sproc.GetStoreIdentifier().DisplayName}' result column '{rc.PropertyName}' is not a property of '{et.Name}'.\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try { _ = ctx.Model; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"corresponding to the result column\"))\n{\n    logger.LogError(\"Result column bound to a missing property. {Msg}\", ex.Message);\n    throw;\n}","preventionTips":["Prefer lambda-based HasResultColumn(x => x.Prop) over string names so renames are compile errors.","Re-run model validation after entity refactors.","When scaffolding, regenerate sproc configs alongside the entity model."],"tags":["efcore","relational","stored-procedure","result-column","property-mapping","model-validation"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}