public override IQueryable <Lite <Entity> > GetEntities(List <Filter> filters) { var ex = new _EntityColumn(EntityColumnFactory().BuildColumnDescription(), QueryName); DQueryable <T> query = Query .ToDQueryable(GetQueryDescription()) .Where(filters) .Select(new List <Column> { ex }); var exp = Expression.Lambda <Func <object, Lite <Entity> > >(Expression.Convert(ex.Token.BuildExpression(query.Context), typeof(Lite <Entity>)), query.Context.Parameter); return(query.Query.Select(exp)); }
public override Lite <Entity> ExecuteUniqueEntity(UniqueEntityRequest request) { var ex = new _EntityColumn(EntityColumnFactory().BuildColumnDescription(), QueryName); DQueryable <T> orderQuery = Query .ToDQueryable(GetQueryDescription()) .SelectMany(request.Multiplications) .Where(request.Filters) .OrderBy(request.Orders); var result = orderQuery .SelectOne(ex.Token) .Unique(request.UniqueType); return((Lite <Entity>)result); }
public override async Task <Lite <Entity>?> ExecuteUniqueEntityAsync(UniqueEntityRequest request, CancellationToken token) { var ex = new _EntityColumn(EntityColumnFactory().BuildColumnDescription(), QueryName); DQueryable <T> orderQuery = Query .ToDQueryable(GetQueryDescription()) .SelectMany(request.Multiplications) .Where(request.Filters) .OrderBy(request.Orders); var result = await orderQuery .SelectOne(ex.Token) .UniqueAsync(request.UniqueType, token); return((Lite <Entity>?)result); }
public override IQueryable<Lite<Entity>> GetEntities(QueryEntitiesRequest request) { var ex = new _EntityColumn(EntityColumnFactory().BuildColumnDescription(), QueryName); DQueryable<T> query = Query .ToDQueryable(GetQueryDescription()) .OrderBy(request.Orders) .Where(request.Filters) .Select(new List<Column> { ex }); var exp = Expression.Lambda<Func<object, Lite<Entity>>>(Expression.Convert(ex.Token.BuildExpression(query.Context), typeof(Lite<Entity>)), query.Context.Parameter); var result = query.Query.Select(exp); return result.TryTake(request.Count); }
public override Lite <Entity> ExecuteUniqueEntity(UniqueEntityRequest request) { var ex = new _EntityColumn(EntityColumnFactory().BuildColumnDescription(), QueryName); DQueryable <T> orderQuery = Query .ToDQueryable(GetQueryDescription()) .SelectMany(request.Multiplications) .Where(request.Filters) .OrderBy(request.Orders) .Select(new List <Column> { ex }); var exp = Expression.Lambda <Func <object, Lite <IEntity> > >(Expression.Convert(ex.Token.BuildExpression(orderQuery.Context), typeof(Lite <IEntity>)), orderQuery.Context.Parameter); return((Lite <Entity>)orderQuery.Query.Select(exp).Unique(request.UniqueType)); }
public override IQueryable <Lite <Entity> > GetEntities(QueryEntitiesRequest request) { var ex = new _EntityColumn(EntityColumnFactory().BuildColumnDescription(), QueryName); DQueryable <T> query = Query .ToDQueryable(GetQueryDescription()) .SelectMany(request.Multiplications) .OrderBy(request.Orders) .Where(request.Filters) .Select(new List <Column> { ex }); var result = query.Query.Select(query.Context.GetEntitySelector()); if (request.Multiplications.Any()) { result = result.Distinct(); } return(result.TryTake(request.Count)); }