示例#1
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));
        }
        /// <summary>
        /// remove data
        /// </summary>
        /// <param name="data">data</param>
        /// <param name="activationOption">activation option</param>
        /// <returns></returns>
        public async Task <IActivationRecord> RemoveAsync(ET data, ActivationOption activationOption = null)
        {
            await WarehouseManager.RemoveAsync(data).ConfigureAwait(false);

            var identityValue = data.GetIdentityValue();

            return(DefaultActivationRecord <ET, DAI> .CreateRemoveObjectRecord(identityValue, activationOption));
        }
示例#3
0
        /// <summary>
        /// remove data
        /// </summary>
        /// <typeparam name="ET">entity</typeparam>
        /// <typeparam name="DAI">persistent data service</typeparam>
        /// <param name="datas">datas</param>
        /// <returns></returns>
        public async Task <IActivationRecord> RemoveAsync(params ET[] datas)
        {
            if (datas.IsNullOrEmpty())
            {
                return(null);
            }
            await WarehouseManager.RemoveAsync(datas);

            var packageRecord = DefaultActivationRecord <ET, DAI> .CreatePackageRecord();

            foreach (var data in datas)
            {
                var identityValue = data.GetIdentityValue();
                packageRecord.AddFollowRecords(DefaultActivationRecord <ET, DAI> .CreateRemoveObjectRecord(identityValue));
            }
            return(packageRecord);
        }