private void ExecuteBatch(Action <IStorageActionsAccessor> action) { if (current.Value != null) { action(current.Value); return; } using (var snapshot = tableStorage.CreateSnapshot()) { var writeBatchRef = new Reference <WriteBatch>(); try { writeBatchRef.Value = new WriteBatch { DisposeAfterWrite = false }; using (var storageActionsAccessor = new StorageActionsAccessor(tableStorage, writeBatchRef, snapshot, idGenerator, bufferPool)) { current.Value = storageActionsAccessor; action(storageActionsAccessor); storageActionsAccessor.Commit(); tableStorage.Write(writeBatchRef.Value); } } finally { if (writeBatchRef.Value != null) { writeBatchRef.Value.Dispose(); } } } }
private void ExecuteBatch(Action<IStorageActionsAccessor> action) { if (current.Value != null) { action(current.Value); return; } using (var snapshot = tableStorage.CreateSnapshot()) { var writeBatchRef = new Reference<WriteBatch>(); try { writeBatchRef.Value = new WriteBatch { DisposeAfterWrite = false }; using (var storageActionsAccessor = new StorageActionsAccessor(tableStorage, writeBatchRef, snapshot, idGenerator, bufferPool)) { current.Value = storageActionsAccessor; action(storageActionsAccessor); storageActionsAccessor.Commit(); tableStorage.Write(writeBatchRef.Value); } } finally { if (writeBatchRef.Value != null) { writeBatchRef.Value.Dispose(); } } } }