Exemplo n.º 1
0
        public async Task DeleteAsync(List <Guid> lstObjects, IParams parameters)
        {
            using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                var parametersToAfter = validator.BeforeDelete(lstObjects, parameters.IdentityWorkID);
                await baseRecordManager.DeleteAsync(lstObjects, parameters.IdentityWorkID).ContinueWith(_ =>
                {
                    if (_.Exception != null)
                    {
                        throw new Exception($"Ocurrió un error al borrar el registro {typeof(T).Name}", _.Exception);
                    }
                });

                await validator.AfterDeleteAsync(lstObjects, parameters);

                scope.Complete();
            }
        }