示例#1
0
        /// <summary>
        /// query data paging
        /// </summary>
        /// <param name="query">query model</param>
        /// <returns>object paging</returns>
        public async Task <IPaging <ET> > GetPagingAsync(IQuery query)
        {
            IPaging <ET> paging = Paging <ET> .EmptyPaging();

            paging = WarehouseManager.MergePaging(paging, query);
            return(await Task.FromResult(paging));
        }
示例#2
0
        /// <summary>
        /// Remove data
        /// </summary>
        /// <param name="data">Data</param>
        /// <param name="activationOption">Activation option</param>
        /// <returns>Return the activation record</returns>
        public IActivationRecord Remove(TEntity data, ActivationOption activationOption = null)
        {
            WarehouseManager.Remove(data);
            var identityValue = data.GetIdentityValue();

            return(DefaultActivationRecord <TEntity, TDataAccess> .CreateRemoveObjectRecord(identityValue, activationOption));
        }
示例#3
0
        /// <summary>
        /// query data
        /// </summary>
        /// <param name="query">query object</param>
        /// <returns>data</returns>
        public async Task <ET> GetAsync(IQuery query)
        {
            ET data = null;

            data = WarehouseManager.Merge(data, query);
            return(await Task.FromResult(data));
        }
        /// <summary>
        /// Save data
        /// </summary>
        /// <param name="data">Data</param>
        /// <param name="activationOptions">Activation options</param>
        /// <returns>Return the activation record</returns>
        public IActivationRecord Save(TEntity data, ActivationOptions activationOptions = null)
        {
            WarehouseManager.Save(data);
            var identityValue = data.GetIdentityValue();

            return(DefaultActivationRecord <TEntity, TDataAccess> .CreateSaveRecord(identityValue, activationOptions));
        }
示例#5
0
        /// <summary>
        /// Query data list
        /// </summary>
        /// <param name="query">Query model</param>
        /// <returns>Return data list</returns>
        public async Task <List <TEntity> > GetListAsync(IQuery query)
        {
            var datas = await dataAccess.GetListAsync(query).ConfigureAwait(false);

            datas = WarehouseManager.Merge <TEntity>(datas, query);
            return(datas);
        }
示例#6
0
        /// <summary>
        /// Query data paging
        /// </summary>
        /// <param name="query">Query object</param>
        /// <returns>Return data paging</returns>
        public async Task <IPaging <TEntity> > GetPagingAsync(IQuery query)
        {
            var paging = Pager.Empty <TEntity>();

            paging = WarehouseManager.MergePaging(paging, query);
            return(await Task.FromResult(paging).ConfigureAwait(false));
        }
示例#7
0
        /// <summary>
        /// Exist data
        /// </summary>
        /// <param name="query">Query object</param>
        /// <returns>Return whether has data</returns>
        public async Task <bool> ExistAsync(IQuery query)
        {
            var result  = WarehouseManager.Exist <TEntity>(query);
            var isExist = result.IsExist;

            return(await Task.FromResult(isExist).ConfigureAwait(false));;
        }
示例#8
0
        /// <summary>
        /// Query data list
        /// </summary>
        /// <param name="query">Query object</param>
        /// <returns>Return data list</returns>
        public async Task <List <TEntity> > GetListAsync(IQuery query)
        {
            var datas = new List <TEntity>(0);

            datas = WarehouseManager.Merge(datas, query);
            return(await Task.FromResult(datas).ConfigureAwait(false));
        }
示例#9
0
        /// <summary>
        /// Query data paging
        /// </summary>
        /// <param name="query">Query model</param>
        /// <returns>Return data paging</returns>
        public async Task <IPaging <TEntity> > GetPagingAsync(IQuery query)
        {
            var paging = await dataAccess.GetPagingAsync(query).ConfigureAwait(false);

            paging = WarehouseManager.MergePaging(paging, query);
            return(paging);
        }
示例#10
0
        /// <summary>
        /// Modify
        /// </summary>
        /// <param name="modifyExpression">Modify expression</param>
        /// <param name="query">Query object</param>
        /// <returns>Return the activation record</returns>
        public IActivationRecord Modify(IModify modifyExpression, IQuery query, ActivationOption activationOption = null)
        {
            WarehouseManager.Modify <TEntity>(modifyExpression, query);
            var record = DefaultActivationRecord <TEntity, TDataAccess> .CreateModifyRecord(modifyExpression, query, activationOption);

            return(record);
        }
示例#11
0
        /// <summary>
        /// query data
        /// </summary>
        /// <param name="query">query object</param>
        /// <returns>data</returns>
        public async Task <ET> GetAsync(IQuery query)
        {
            var data = await ContainerManager.Resolve <DAI>().GetAsync(query).ConfigureAwait(false);

            data = WarehouseManager.Merge(data, query);
            return(data);
        }
示例#12
0
        /// <summary>
        /// query data list
        /// </summary>
        /// <param name="query">query model</param>
        /// <returns>object list</returns>
        public async Task <List <ET> > GetListAsync(IQuery query)
        {
            var datas = await ContainerManager.Resolve <DAI>().GetListAsync(query).ConfigureAwait(false);

            datas = WarehouseManager.Merge <ET>(datas, query);
            return(datas);
        }
示例#13
0
        /// <summary>
        /// Remove
        /// </summary>
        /// <param name="query">Query object</param>
        /// <returns>Return the activation record</returns>
        public IActivationRecord Remove(IQuery query, ActivationOption activationOption = null)
        {
            WarehouseManager.Remove <TEntity>(query);
            var record = DefaultActivationRecord <TEntity, TDataAccess> .CreateRemoveByConditionRecord(query, activationOption);

            return(record);
        }
示例#14
0
        /// <summary>
        /// query data paging
        /// </summary>
        /// <param name="query">query model</param>
        /// <returns>object paging</returns>
        public async Task <IPaging <ET> > GetPagingAsync(IQuery query)
        {
            var paging = await ContainerManager.Resolve <DAI>().GetPagingAsync(query).ConfigureAwait(false);

            paging = WarehouseManager.MergePaging(paging, query);
            return(paging);
        }
示例#15
0
        /// <summary>
        /// query data list
        /// </summary>
        /// <param name="query">query model</param>
        /// <returns>object list</returns>
        public async Task <List <ET> > GetListAsync(IQuery query)
        {
            var datas = new List <ET>(0);

            datas = WarehouseManager.Merge <ET>(datas, query);
            return(await Task.FromResult(datas));
        }
示例#16
0
        /// <summary>
        /// Query data
        /// </summary>
        /// <param name="query">Query object</param>
        /// <returns>Return entity data</returns>
        public async Task <TEntity> GetAsync(IQuery query)
        {
            TEntity data = null;

            data = WarehouseManager.Merge(data, query);
            return(await Task.FromResult(data).ConfigureAwait(false));
        }
示例#17
0
        /// <summary>
        /// Query data
        /// </summary>
        /// <param name="query">Query object</param>
        /// <returns>Return data</returns>
        public async Task <TEntity> GetAsync(IQuery query)
        {
            var data = await dataAccess.GetAsync(query).ConfigureAwait(false);

            data = WarehouseManager.Merge(data, query);
            return(data);
        }
示例#18
0
        /// <summary>
        /// Get sum value
        /// </summary>
        /// <typeparam name="TValue">Value type</typeparam>
        /// <param name="query">Query object</param>
        /// <returns>Return the sum value</returns>
        public async Task <TValue> SumAsync <TValue>(IQuery query)
        {
            var     sumResult = WarehouseManager.Sum <TEntity, TValue>(query);
            dynamic resultVal = sumResult.Value;

            return(await Task.FromResult(resultVal).ConfigureAwait(false));
        }
示例#19
0
        /// <summary>
        /// remove
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public async Task <IActivationRecord> RemoveAsync(IQuery query)
        {
            await WarehouseManager.RemoveAsync <ET>(query);

            var record = DefaultActivationRecord <ET, DAI> .CreateRemoveByConditionRecord(query);

            return(record);
        }
示例#20
0
        /// <summary>
        /// Get Data Count
        /// </summary>
        /// <param name="query">query model</param>
        /// <returns></returns>
        public async Task <long> CountAsync(IQuery query)
        {
            long allCount    = 0;
            var  countResult = await WarehouseManager.CountAsync <ET>(query).ConfigureAwait(false);

            allCount = allCount - countResult.PersistentDataCount + countResult.NewDataCount;
            return(allCount);
        }
        /// <summary>
        /// Get data count
        /// </summary>
        /// <param name="query">Query model</param>
        /// <returns>Return data count</returns>
        public async Task <long> CountAsync(IQuery query)
        {
            var countResult = WarehouseManager.Count <TEntity>(query);

            countResult.Count += await dataAccess.CountAsync(countResult.ComputeQuery).ConfigureAwait(false);

            return(countResult.Count);
        }
示例#22
0
        /// <summary>
        /// Get data count
        /// </summary>
        /// <param name="query">Query object</param>
        /// <returns>Return data count</returns>
        public async Task <long> CountAsync(IQuery query)
        {
            long allCount    = 0;
            var  countResult = WarehouseManager.Count <TEntity>(query);

            allCount = allCount - countResult.PersistentDataCount + countResult.NewDataCount;
            return(await Task.FromResult(allCount).ConfigureAwait(false));
        }
        /// <summary>
        /// save data
        /// </summary>
        /// <param name="data">data</param>
        /// <param name="activationOption">activation option</param>
        /// <returns></returns>
        public async Task <IActivationRecord> SaveAsync(ET data, ActivationOption activationOption = null)
        {
            await WarehouseManager.SaveAsync(data).ConfigureAwait(false);

            var identityValue = data.GetIdentityValue();

            return(DefaultActivationRecord <ET, DAI> .CreateSaveRecord(identityValue, activationOption));
        }
示例#24
0
        /// <summary>
        /// Get Sum Value
        /// </summary>
        /// <typeparam name="DT">DataType</typeparam>
        /// <param name="query">query model</param>
        /// <returns>sum value</returns>
        public async Task <DT> SumAsync <DT>(IQuery query)
        {
            var sumResult = await WarehouseManager.SumAsync <ET, DT>(query).ConfigureAwait(false);

            dynamic resultVal = sumResult.Value;

            return(resultVal);
        }
示例#25
0
        /// <summary>
        /// modify
        /// </summary>
        /// <param name="modifyExpression">modify expression</param>
        /// <param name="query">query</param>
        /// <returns></returns>
        public async Task <IActivationRecord> ModifyAsync(IModify modifyExpression, IQuery query)
        {
            await WarehouseManager.ModifyAsync <ET>(modifyExpression, query);

            var record = DefaultActivationRecord <ET, DAI> .CreateModifyRecord(modifyExpression, query);

            return(record);
        }
示例#26
0
        /// <summary>
        /// exist data
        /// </summary>
        /// <param name="query">query model</param>
        /// <returns></returns>
        public async Task <bool> ExistAsync(IQuery query)
        {
            var result = await WarehouseManager.ExistAsync <ET>(query).ConfigureAwait(false);

            var isExist = result.IsExist;

            return(isExist);
        }
示例#27
0
 /// <summary>
 /// Get life source
 /// </summary>
 /// <param name="data">Data</param>
 /// <returns>Return the data life source</returns>
 public DataLifeSource GetLifeSource(TEntity data)
 {
     if (data == null)
     {
         return(DataLifeSource.New);
     }
     return(WarehouseManager.GetLifeSource(data));
 }
示例#28
0
        /// <summary>
        /// Get min value
        /// </summary>
        /// <typeparam name="TValue">Value type</typeparam>
        /// <param name="query">Query model</param>
        /// <returns>Return the min value</returns>
        public async Task <TValue> MinAsync <TValue>(IQuery query)
        {
            var     minResult = WarehouseManager.Min <TEntity, TValue>(query);
            dynamic resultVal = minResult.Value;
            dynamic minValue  = await dataAccess.MinAsync <TValue>(minResult.ComputeQuery).ConfigureAwait(false);

            return(minResult.ValidValue ? (resultVal < minValue ? resultVal : minValue) : minValue);
        }
示例#29
0
        /// <summary>
        /// Get Sum Value
        /// </summary>
        /// <typeparam name="TValue">Value type</typeparam>
        /// <param name="query">Query model</param>
        /// <returns>Return the sum value</returns>
        public async Task <TValue> SumAsync <TValue>(IQuery query)
        {
            var     sumResult = WarehouseManager.Sum <TEntity, TValue>(query);
            dynamic resultVal = sumResult.Value;
            dynamic sumValue  = await dataAccess.SumAsync <TValue>(sumResult.ComputeQuery).ConfigureAwait(false);

            return(sumResult.ValidValue ? resultVal + sumValue : sumValue);
        }
示例#30
0
        /// <summary>
        /// Get data count
        /// </summary>
        /// <param name="query">Query model</param>
        /// <returns>Return data count</returns>
        public async Task <long> CountAsync(IQuery query)
        {
            var allCount = await dataAccess.CountAsync(query).ConfigureAwait(false);

            var countResult = WarehouseManager.Count <TEntity>(query);

            allCount = allCount - countResult.PersistentDataRemoveCount + countResult.NewDataCount;
            return(allCount);
        }