System.InvalidOperationException: No suitable constructor was found for the type 'Patient'. — the entity's only constructor had a parameter, fullName, whose name matched no mapped property. Rename the parameter to match the property (name for Name) and EF Core can call the constructor when it reads rows.

The message names the parameter it could not bind, so the fix starts there: find the property the parameter is meant to fill and give the parameter that property's name.

The error

PS> dotnet run
Unhandled exception. System.InvalidOperationException: No suitable constructor was found for the type 'Patient'. The following constructors had parameters that could not be bound to properties of the type:
    Cannot bind 'fullName' in 'Patient(string fullName)'
Note that only mapped properties can be bound to constructor parameters. Navigations to related entities, including references to owned types, cannot be bound.
   at Microsoft.EntityFrameworkCore.Metadata.Internal.ConstructorBindingFactory.GetBindings[T](T type, Func`5 bindToProperty, Func`5 bind, InstantiationBinding& constructorBinding, InstantiationBinding& serviceOnlyBinding)
...
   at Program.<Main>$(String[] args) in ...\EfCtor\Program.cs:line 4

The cut hides EF Core model-building and DI frames. The message on EF Core 10.0.14 reads "for the type". Its last line adds that navigations to related entities and owned types cannot be bound either; this model had neither, so the single unmatched parameter name was the whole problem. The fixed run printed 1: Amara Okafor, the generated key and the name that went through the constructor.

Why it happens

public class Patient
{
    public Patient(string fullName) { Name = fullName; }
    public int Id { get; set; }
    public string Name { get; set; }
}

Patient has no parameterless constructor, only one that takes fullName. The message says that only mapped properties can be bound to constructor parameters; the mapped properties here are Id and Name, there is no FullName, so EF Core reported Cannot bind 'fullName' and rejected the constructor. The exception came from the model-building conventions (ConstructorBindingConvention in the trace) at line 4, db.Database.EnsureDeleted(): the first call that needed the model, before any row was read or written.

The fix

public Patient(string name) { Name = name; }
PS> dotnet run -p:DefineConstants=FIXED
1: Amara Okafor

In the lab project both constructors sit in one file behind #if FIXED, and the property -p:DefineConstants=FIXED picks the renamed one. With name as the parameter, the program created the SQLite database, saved one patient, cleared the change tracker and read the row back through the constructor. The parameter name was the only change between the failing and the working build.

How it was reproduced

A console project from dotnet new console -n EfCtor on .NET SDK 10.0.403 with Microsoft.EntityFrameworkCore.Sqlite 10.0.14 and a SQLite file clinic.db. The Patient entity had a single constructor taking string fullName; dotnet run threw on the first database call. The fictional patient Amara Okafor was the only row.

Frequently asked

What does No suitable constructor was found for the type mean in EF Core?
The entity has no constructor EF Core can call. In the reproduction the only constructor took a parameter named fullName, and no mapped property had that name.
Do EF Core constructor parameter names have to match property names?
In the reproduction they did: Patient(string fullName) was rejected with Cannot bind 'fullName', and Patient(string name) for the property Name worked.
Why does the constructor error happen before any query runs?
It is raised while the model is built. In the reproduction it was thrown at EnsureDeleted, the first call that used the model, before any row was saved or read.

More decoded errors in the Fixes category.