Пример #1
0
        public async Task <ResultTable> FindRowsLike([Required, FromBody] AutocompleteQueryRequestTS request, CancellationToken token)
        {
            var qn = QueryLogic.ToQueryName(request.queryKey);
            var qd = QueryLogic.Queries.QueryDescription(qn);

            var dqRequest = new DQueryableRequest
            {
                QueryName = qn,
                Columns   = request.columns.EmptyIfNull().Select(a => a.ToColumn(qd, false)).ToList(),
                Filters   = request.filters.EmptyIfNull().Select(a => a.ToFilter(qd, false)).ToList(),
                Orders    = request.orders.EmptyIfNull().Select(a => a.ToOrder(qd, false)).ToList()
            };

            var dqueryable = QueryLogic.Queries.GetDQueryable(dqRequest);
            var entityType = qd.Columns.Single(a => a.IsEntity).Implementations !.Value.Types.SingleEx();

            var result = await dqueryable.Query.AutocompleteUntypedAsync(dqueryable.Context.GetEntitySelector(), request.subString, request.count, entityType, token);

            var columnAccessors = dqRequest.Columns.Select(c => (
                                                               column: c,
                                                               lambda: Expression.Lambda(c.Token.BuildExpression(dqueryable.Context), dqueryable.Context.Parameter)
                                                               )).ToList();

            return(DQueryable.ToResultTable(result.ToArray(), columnAccessors, null, new Pagination.Firsts(request.count)));
        }
Пример #2
0
        public List<Lite<Entity>> FindLiteLikeWithFilters(AutocompleteQueryRequestTS request)
        {
            var qn = QueryLogic.ToQueryName(request.queryKey);
            var qd = DynamicQueryManager.Current.QueryDescription(qn);
            var filters = request.filters.Select(a => a.ToFilter(qd, false)).ToList();

            var entitiesQuery = DynamicQueryManager.Current.GetEntities(qn, filters);
            var entityType = qd.Columns.Single(a => a.IsEntity).Implementations.Value.Types.SingleEx();

            return entitiesQuery.AutocompleteUntyped(request.subString, request.count, entityType);
        }
Пример #3
0
        public List <Lite <Entity> > FindLiteLikeWithFilters(AutocompleteQueryRequestTS request)
        {
            var qn      = QueryLogic.ToQueryName(request.queryKey);
            var qd      = DynamicQueryManager.Current.QueryDescription(qn);
            var filters = request.filters.Select(a => a.ToFilter(qd, false)).ToList();

            var entitiesQuery = DynamicQueryManager.Current.GetEntities(qn, filters);
            var entityType    = qd.Columns.Single(a => a.IsEntity).Implementations.Value.Types.SingleEx();

            return(entitiesQuery.AutocompleteUntyped(request.subString, request.count, entityType));
        }
Пример #4
0
        public async Task <List <Lite <Entity> > > FindLiteLikeWithFilters(AutocompleteQueryRequestTS request, CancellationToken token)
        {
            var qn = QueryLogic.ToQueryName(request.queryKey);
            var qd = DynamicQueryManager.Current.QueryDescription(qn);

            var entitiesQuery = DynamicQueryManager.Current.GetEntities(new QueryEntitiesRequest
            {
                QueryName = qn,
                Filters   = request.filters.EmptyIfNull().Select(a => a.ToFilter(qd, false)).ToList(),
                Orders    = request.orders.EmptyIfNull().Select(a => a.ToOrder(qd, false)).ToList()
            });
            var entityType = qd.Columns.Single(a => a.IsEntity).Implementations.Value.Types.SingleEx();

            return(await entitiesQuery.AutocompleteUntypedAsync(request.subString, request.count, entityType, token));
        }