dotnet/efcore · error · InvalidOperationException
No property named '{property}' found on the entity type '{en
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 when a stored procedure result column references a property name that is not found in the valid property set for the entity and mapping strategy. The validator looks up resultColumn.PropertyName in the properties dictionary (which varies by TPH/TPT/TPC) and rejects an unknown name. Result columns must correspond to actual properties.
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 dbf9771522)
Solutions
- Verify the property name exactly matches an existing property on the entity.
- Check the mapping strategy; ensure the property is in scope (e.g. derived properties need TPH).
- Remove the result column if it references a non-existent property.
Example fix
// before
.InsertStoredProcedure("sp_InsertBlog", sp =>
{
sp.HasResultColumn("CreateDate"); // property is actually named CreatedOn
});
// after
sp.HasResultColumn("CreatedOn"); Defensive patterns
Strategy: validation
Validate before calling
foreach (var et in modelBuilder.Model.GetEntityTypes())
{
var names = et.GetProperties().Select(p => p.Name).ToHashSet();
foreach (var t in new[] { StoreObjectType.InsertStoredProcedure, StoreObjectType.UpdateStoredProcedure })
{
var sproc = t == StoreObjectType.InsertStoredProcedure ? et.GetInsertStoredProcedure() : et.GetUpdateStoredProcedure();
if (sproc == null) continue;
foreach (var rc in sproc.ResultColumns)
if (rc.PropertyName != null && !names.Contains(rc.PropertyName))
throw new InvalidOperationException($"Result column {rc.PropertyName} not a property of {et.DisplayName()}");
}
} Try / catch
try { _ = ctx.Model; } catch (InvalidOperationException ex) when (ex.Message.Contains("No property named")) { /* fix the result column property name */ } Prevention
- Use nameof(Property) when configuring result columns.
- Update sproc config whenever a property is renamed or removed.
When it happens
Trigger: Calling .HasResultColumn("TypoName"); referencing a property that was renamed or removed; referencing a derived property under a strategy that excludes it.
Common situations: Renaming a property without updating the sproc config; strategy changes (e.g. TPH->TPT) that alter which properties are in scope; stale sproc mappings after model refactors.
Related errors
- The result column '{column}' cannot be added to the stored p
- The property '{entityType}.{property}' is mapped to a result
- The property '{entityType}.{property}' is mapped to a result
- The entity type '{entityType}' was configured to use some st
- The entity type '{entityType}' was configured to use '{sproc
AI-assisted analysis of dotnet/efcore@dbf9771522 (2026-08-06).
Data as JSON: /api/errors/c2f4cd092f9c1dd5.
Report an issue: GitHub.