public class ContactService
{
private readonly SampleContext _dbContext;
public ContactService(SampleContext dbContext)
{
_dbContext = dbContext;
}
public List<Contact> Contacts(Expression<Func<Contact, bool>> filter,
params Expression<Func<Contact, object>>[] eagerloads)
{
var dbSet = _dbContext.Contacts;
foreach (var eagerload in eagerloads)
dbSet.Include(eagerload);
return dbSet.Where(filter).ToList();
}
}