using System.Linq.Expressions; namespace MessengerBroker { public static class EntityExtensions { public static IQueryable GetUsers(this IQueryable source, Guid[] guids) { return source.Where(x => guids.Any(g => g == x.Id)); } public static IQueryable GetUsersExcept(this IQueryable source, IEnumerable guids) { return source.Where(x => !guids.Any(g => g == x.Id)); } public static bool GetUserExists(this IQueryable source, Guid id) { return source.Any(x=> x.Id == id); } } }