-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Copy link
Milestone
Description
We have a disconnect between what the documents say should be happening versus what's implemented.
In the file IReadOnlyEntityType.cs when you try to get a property that does not exist it throws an InvalidOperationException whereas the expected return value is null.
Example
var entityType = MyDbContext.Set<E>().EntityType;
var property = entityType.GetProperty(invalidPropertyName); // this throws an exceptionInclude stack traces
System.InvalidOperationException: The property 'MyTable.invalidPropertyName' could not be found. Ensure that the property exists and has been included in the model.
at Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType.GetProperty(String name)
at Microsoft.EntityFrameworkCore.Metadata.IEntityType.GetProperty(String name)
Include provider and version information
EF Core version: 6.0.3
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6
Operating system: Windows 10
IDE: VS 2022
Reactions are currently unavailable