コード例 #1
0
        private async Task <int> saveChangesAndUpdateParentScopeAsync(DetectModifiedEntitiesAndUpdateParentScope parentUpdater, CancellationToken cancellationToken = default(CancellationToken))
        {
            var changes = await GetCurrentScope().SaveChangesAsync(cancellationToken);

            await parentUpdater.UpdateParentAsync(cancellationToken);

            return(changes);
        }
コード例 #2
0
        protected override int OnHandleSaveChanges(IInvocation invocation)
        {
            var dbContext     = (DbContext)invocation.Proxy;
            var parentUpdater = new DetectModifiedEntitiesAndUpdateParentScope(dbContext, GetCurrentScope());

            var changes = GetCurrentScope().SaveChanges();

            parentUpdater.UpdateParent();

            return(changes);
        }
コード例 #3
0
        protected override Task <int> OnHandleSaveChangesAsync(IInvocation invocation)
        {
            var dbContext     = (DbContext)invocation.Proxy;
            var parentUpdater = new DetectModifiedEntitiesAndUpdateParentScope(dbContext, GetCurrentScope());

            Task <int> returnValue;

            var maybeCancellationToken = GetCancellationTokenFromArgs(invocation);

            if (maybeCancellationToken.HasValue)
            {
                returnValue = saveChangesAndUpdateParentScopeAsync(parentUpdater, maybeCancellationToken.Value);
            }
            else
            {
                returnValue = saveChangesAndUpdateParentScopeAsync(parentUpdater);
            }

            return(returnValue);
        }