コード例 #1
0
ファイル: AutoDynamicQuery.cs プロジェクト: hua7073/framework
        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));
        }
コード例 #2
0
ファイル: AutoDynamicQuery.cs プロジェクト: hua7073/framework
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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));
        }
コード例 #6
0
ファイル: AutoDynamicQuery.cs プロジェクト: m-adi/framework
        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));
        }