/// <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)); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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));; }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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); }
/// <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); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }