Are there any way to get the following expression to work in EF Core 3.1?
_db.Customers
.Where(customer => customer.IsFavorite(userId))
.ToList();
IsFavorite is a simple expression that compares multiple properties with the userId. This could obviously be rewritten as
_db.Customers
.Where(customer => customer.Prop1 == userId || customer.Prop2 == userId)
.ToList();
But i'd like to avoid duplicating this logic. Other uses are when filtering on child properties, such as:
_db.Orders
.Where(order => order.Customer.IsFavorite(userId))
.ToList();
Any suggestions?