dotnet/efcore · error · InvalidOperationException
No property named ' ' found on the entity type ' '…
Error message
No property named '{property}' found on the entity type '{entityType}' corresponding to the result column on the stored procedure '{sproc}'. What it means
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.
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.
Example fix
// before
modelBuilder.Entity<Customer>()
.InsertUsingStoredProcedure("dbo.CustomerInsert", sp =>
{
sp.HasResultColumn("CreatedAt"); // property renamed to CreatedOn
});
// after
modelBuilder.Entity<Customer>()
.InsertUsingStoredProcedure("dbo.CustomerInsert", sp =>
{
sp.HasResultColumn(c => c.CreatedOn);
}); Defensive patterns
Strategy: validation
Validate before calling
// After configuring each sproc, verify every bound result column resolves to a property.
foreach (var et in modelBuilder.Model.GetEntityTypes())
{
var propNames = et.GetProperties().Select(p => p.Name).ToHashSet();
foreach (var sproc in new[] { et.GetInsertStoredProcedure(), et.GetUpdateStoredProcedure(), et.GetDeleteStoredProcedure() })
{
if (sproc is null) continue;
foreach (var rc in sproc.ResultColumns)
if (rc.PropertyName is not null && !propNames.Contains(rc.PropertyName))
throw new InvalidOperationException($"Sproc '{sproc.GetStoreIdentifier().DisplayName}' result column '{rc.PropertyName}' is not a property of '{et.Name}'.");
}
} Try / catch
try { _ = ctx.Model; }
catch (InvalidOperationException ex) when (ex.Message.Contains("corresponding to the result column"))
{
logger.LogError("Result column bound to a missing property. {Msg}", ex.Message);
throw;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No property named ' ' found on the entity type ' '…
- The property ' . ' is mapped to a result column of the…
- The property ' . ' is mapped to a result column of the…
- The result column ' ' cannot be added to the stored…
- Both entity type ' ' and ' ' were configured to use ' '…
AI-assisted analysis of dotnet/efcore@3a2006ef56 (2026-08-11).
Data as JSON: /api/errors/c2f4cd092f9c1dd5.
Report an issue: GitHub.
Appendix: source
Thrown at src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs:659
if (mappingStrategy == RelationalAnnotationNames.TptMappingStrategy
&& storeObjectIdentifier.StoreObjectType == StoreObjectType.InsertStoredProcedure
&& entityType.BaseType?.GetInsertStoredProcedure() != null)
{
foreach (var property in primaryKey.Properties)
{
storeGeneratedProperties.Remove(property.Name);
}
}
var resultColumnNames = new HashSet<string>();
foreach (var resultColumn in sproc.ResultColumns)
{
IProperty? property = null!;
if (resultColumn.PropertyName != null
&& !properties.TryGetValue(resultColumn.PropertyName, out property))
{
throw new InvalidOperationException(
RelationalStrings.StoredProcedureResultColumnNotFound(
resultColumn.PropertyName, entityType.DisplayName(), storeObjectIdentifier.DisplayName()));
}
if (!resultColumnNames.Add(resultColumn.Name))
{
throw new InvalidOperationException(
RelationalStrings.StoredProcedureDuplicateResultColumnName(
resultColumn.Name, storeObjectIdentifier.DisplayName()));
}
if (resultColumn.PropertyName == null)
{
continue;
}
switch (storeObjectIdentifier.StoreObjectType)
{View on GitHub (pinned to 3a2006ef56)