-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Description
Bug description
Context: we have multi-select drop-downs that we use to filter data server-side in a Grid.
The setup is somewhat convoluted and ends up calling this function:
public IQueryable<T> Filter<T>(IQueryable<T> source) {
return source.Where(cf => SelectedKeys.Contains(EF.Property<int>(cf!, PropertyName)));
}
With:
- SelectedKeys :
HashSet<int>
- T something like:
[Table("MailHistory")]
public class MailHistoryEntity
{
...
public MailHistoryStatus MailHistoryStatus { get; set; }
}
- PropertyName = "MailHistoryStatus"
- MailHistoryStatus an enum
This worked without issues in EF Core 8, but in EF Core 9 it crashes with:
Error: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation.
---> System.InvalidOperationException: No coercion operator is defined between types
'Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer`1[PROJECT_NAME.Enums.MailHistoryStatus]' and
'Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer`1[System.Int32]'.
EF Core version
9
Database provider
SQL Server
Target framework
.net 8
Operating system
Windows 11
IDE
Visual Studio 2022