예제 #1
0
        public override sealed async Task <object> EventManyAsync(Query <TModel> query)
        {
            var whereCompressed = CompressWhere(query.Where);
            var orderCompressed = CompressOrder(query.Order);

            var appenedQuery = new Query <TModel>(query);

            appenedQuery.Where = whereCompressed;
            appenedQuery.Order = orderCompressed;

            var eventModels = (ICollection <EventModel <TModel> >)(await NextProvider.QueryAsync(appenedQuery));

            if (eventModels.Count == 0)
            {
                return(eventModels);
            }

            var compressedModels = eventModels.Select(x => x.Model).ToArray();
            var models           = DecompressModels(compressedModels, query.Graph, true);
            int i = 0;

            foreach (var eventModel in eventModels)
            {
                eventModel.Model = compressedModels[i];
                i++;
            }

            return(eventModels);
        }
예제 #2
0
        public override sealed async Task <object> EventManyAsync(Query <TModel> query)
        {
            var appenedQuery = new Query <TModel>(query);

            OnQuery(appenedQuery.Graph);

            var where          = AppendWhereExpression(appenedQuery.Where, appenedQuery.Graph);
            appenedQuery.Where = where;

            var eventModels = (ICollection <EventModel <TModel> >)(await NextProvider.QueryAsync(appenedQuery));

            var models = eventModels.Select(x => x.Model).ToArray();

            ICollection <EventModel <TModel> > returnEventModels = null;

            if (models.Length > 0)
            {
                var returnModels = OnGet(models, appenedQuery.Graph);
                returnEventModels = returnEventModels.Where(x => returnModels.Contains(x.Model)).ToArray();
            }
            else
            {
                returnEventModels = Array.Empty <EventModel <TModel> >();
            }

            return(returnEventModels);
        }
예제 #3
0
 public Task <object> QueryAsync(Query <TModel> query)
 {
     if (query.IsTemporal)
     {
         return(ThisProvider.QueryAsync(query));
     }
     else
     {
         return(NextProvider.QueryAsync(query));
     }
 }
예제 #4
0
        public override sealed Task <object> AnyAsync(Query <TModel> query)
        {
            var whereCompressed = CompressWhere(query.Where);

            var appenedQuery = new Query <TModel>(query);

            appenedQuery.Where = whereCompressed;

            var any = NextProvider.QueryAsync(appenedQuery);

            return(any);
        }
        public override sealed Task <object> CountAsync(Query <TModel> query)
        {
            var whereCompressed = EncryptWhere(query.Where);

            var appenedQuery = new Query <TModel>(query);

            appenedQuery.Where = whereCompressed;

            var count = NextProvider.QueryAsync(appenedQuery);

            return(count);
        }
예제 #6
0
        public override sealed Task <object> AnyAsync(Query <TModel> query)
        {
            var appenedQuery = new Query <TModel>(query);

            OnQuery(appenedQuery.Graph);

            var where          = AppendWhereExpression(appenedQuery.Where, appenedQuery.Graph);
            appenedQuery.Where = where;

            var any = NextProvider.QueryAsync(appenedQuery);

            return(any);
        }
예제 #7
0
        public override sealed async Task <object> SingleAsync(Query <TModel> query)
        {
            var whereCompressed = CompressWhere(query.Where);

            var appenedQuery = new Query <TModel>(query);

            appenedQuery.Where = whereCompressed;

            var compressedModels = (TModel)(await NextProvider.QueryAsync(appenedQuery));

            if (compressedModels == null)
            {
                return(null);
            }

            var model = DecompressModel(compressedModels, query.Graph, true);

            return(model);
        }
        public override sealed async Task <object> SingleAsync(Query <TModel> query)
        {
            var whereCompressed = EncryptWhere(query.Where);

            var appenedQuery = new Query <TModel>(query);

            appenedQuery.Where = whereCompressed;

            var encryptedModels = (TModel)(await NextProvider.QueryAsync(appenedQuery));

            if (encryptedModels == null)
            {
                return(null);
            }

            var model = DecryptModels(new TModel[] { encryptedModels }, query.Graph, true).FirstOrDefault();

            return(model);
        }
예제 #9
0
        public override sealed async Task <object> SingleAsync(Query <TModel> query)
        {
            var appenedQuery = new Query <TModel>(query);

            OnQuery(appenedQuery.Graph);

            var where          = AppendWhereExpression(appenedQuery.Where, appenedQuery.Graph);
            appenedQuery.Where = where;

            var model = (TModel)(await NextProvider.QueryAsync(appenedQuery));

            TModel returnModel = null;

            if (model != null)
            {
                returnModel = OnGet(new TModel[] { model }, appenedQuery.Graph).SingleOrDefault();
            }

            return(returnModel);
        }
예제 #10
0
        public override sealed async Task <object> ManyAsync(Query <TModel> query)
        {
            var whereCompressed = CompressWhere(query.Where);
            var orderCompressed = CompressOrder(query.Order);

            var appenedQuery = new Query <TModel>(query);

            appenedQuery.Where = whereCompressed;
            appenedQuery.Order = orderCompressed;

            var compressedModels = (ICollection <TModel>)(await NextProvider.QueryAsync(appenedQuery));

            if (compressedModels.Count == 0)
            {
                return(compressedModels);
            }

            var models = DecompressModels(compressedModels, query.Graph, true);

            return(models);
        }
예제 #11
0
        public override sealed async Task <object> ManyAsync(Query <TModel> query)
        {
            var appenedQuery = new Query <TModel>(query);

            OnQuery(appenedQuery.Graph);
            var where = AppendWhereExpression(appenedQuery.Where, appenedQuery.Graph);

            appenedQuery.Where = where;

            var models = (ICollection <TModel>)(await NextProvider.QueryAsync(appenedQuery));

            ICollection <TModel> returnModels;

            if (models.Count > 0)
            {
                returnModels = OnGet(models, appenedQuery.Graph);
            }
            else
            {
                returnModels = Array.Empty <TModel>();
            }

            return(returnModels);
        }