Ejemplo n.º 1
0
        async Task StartSavingChangesInternal()
        {
            await TaskEx.Yield();

            WaitForFlushIfInProgress();
            Log.Info("Reseting session flush event");
            unitOfWorkFlashInProgressEvent.Reset();
            try
            {
                var result = await databaseApi.BulkUpdate(bulk => unitOfWork.ApplyChanges(bulk));

                // releasing mutex before locking on unitOfWork to prevent dead lock
                Log.Info("Setting session flush event due save operation completion");
                unitOfWorkFlashInProgressEvent.Set();
                lock (unitOfWork)
                    unitOfWork.UpdateRevisions(result.Values);
            }
            catch (Exception e)
            {
                var aggregateException = e as AggregateException;
                if (aggregateException != null)
                {
                    throw aggregateException.Flatten();
                }
                throw;
            }
        }
Ejemplo n.º 2
0
 public IDictionary <string, DocumentInfo> BulkUpdate(Action <IBulkUpdateBatch> updateCommandBuilder)
 {
     return(databaseApi.BulkUpdate(updateCommandBuilder).WaitForResult());
 }