How to invoke Expression<Func<Entity, bool>> against a collection
问题 I have an interface that defines a repository from the Repository pattern: interface IRepository { List<Customer> GetAllCustomers(Expression<Func<Customer, bool>> expression); } I've implemented it against Entity Framework: class EntityFrameworkRepository { public List<Customer> GetAllCustomers(Expression<Func<Customer, bool>> expression) { return DBContext.Customers.Where(expression).ToList(); } } That seems to work well, it allows me to do something like: var customers =