예제 #1
0
        private async Task ValidateAndProcessQueueMessage(string blobName)
        {
            var blob = await GetObjectHistoryBlobAsync(_objectHistoryService.ObjectContainer, blobName);

            var objectHistoryDetailsJson = await blob.DownloadTextAsync();

            var objectHistoryDetails = _objectHistoryService.JsonHelper.GetObjectFromJson <ObjectHistoryDetailRead>(objectHistoryDetailsJson);

            var objectHistoryTable = await _objectHistoryService.GetObjectHistoryTableAsync(objectHistoryDetails.ObjectHistorySettings.ObjectHistoryTable);

            var globalHistoryTable = await _objectHistoryService.GetObjectHistoryTableAsync(objectHistoryDetails.ObjectHistorySettings.GlobalHistoryTable);

            var objectHistoryContainer = await _objectHistoryService.GetObjectHistoryContainerAsync(objectHistoryDetails.ObjectHistorySettings.ObjectContainerName);

            if (!objectHistoryDetails.IsAdd)
            {
                objectHistoryDetails.Diff = ProcessDiff(objectHistoryDetails.OldJson.ToString(), objectHistoryDetails.NewJson.ToString());
            }

            var objectHistoryJson = _objectHistoryService.JsonHelper.GetJson(objectHistoryDetails);

            await _objectHistoryService.AzureStorageHelper.UploadJsonFileAsync(objectHistoryContainer, objectHistoryDetails.Folder, "ObjectHistory.json", objectHistoryJson);

            await _objectHistoryService.AzureStorageHelper.AddObjectHistoryEntityRecordAsync(objectHistoryDetails, objectHistoryTable);

            await _objectHistoryService.AzureStorageHelper.AddObjectHistoryGlobalAsync(objectHistoryDetails, globalHistoryTable);

            await blob.DeleteAsync();
        }
예제 #2
0
        public ObjectHistoryClient(
            ObjectHistoryClientSettings objectHistorySettings,
            ObjectHistoryService objectHistoryService)
        {
            _objectHistorySettings = objectHistorySettings;
            _objectHistoryService  = objectHistoryService;

            _objectHistoryTable = _objectHistoryService.GetObjectHistoryTableAsync(_objectHistorySettings.ObjectHistoryTable).Result;
            _globalHistoryTable = _objectHistoryService.GetGlobalHistoryTableAsync(_objectHistorySettings.GlobalHistoryTable).Result;
            _cloudBlobContainer = _objectHistoryService.GetObjectHistoryContainerAsync(_objectHistorySettings.ObjectContainerName).Result;
        }