Esempio n. 1
0
 internal BlobChangeFeedEventData(Dictionary <string, object> record)
 {
     BlobOperationName = new BlobOperationName((string)record[Constants.ChangeFeed.EventData.Api]);
     ClientRequestId   = Guid.Parse((string)record[Constants.ChangeFeed.EventData.ClientRequestId]);
     RequestId         = Guid.Parse((string)record[Constants.ChangeFeed.EventData.RequestId]);
     ETag          = new ETag((string)record[Constants.ChangeFeed.EventData.Etag]);
     ContentType   = (string)record[Constants.ChangeFeed.EventData.ContentType];
     ContentLength = (long)record[Constants.ChangeFeed.EventData.ContentLength];
     BlobType      = ((string)record[Constants.ChangeFeed.EventData.BlobType]) switch
     {
         Constants.ChangeFeed.EventData.BlockBlob => BlobType.Block,
         Constants.ChangeFeed.EventData.PageBlob => BlobType.Page,
         Constants.ChangeFeed.EventData.AppendBlob => BlobType.Append,
         _ => default
     };
     record.TryGetValue(Constants.ChangeFeed.EventData.ContentOffset, out object contentOffset);
     ContentOffset = (long?)contentOffset;
     record.TryGetValue(Constants.ChangeFeed.EventData.DestinationUrl, out object destinationUrl);
     DestinationUri = !string.IsNullOrEmpty((string)destinationUrl) ? new Uri((string)destinationUrl) : null;
     record.TryGetValue(Constants.ChangeFeed.EventData.SourceUrl, out object sourceUrl);
     SourceUri = !string.IsNullOrEmpty((string)sourceUrl) ? new Uri((string)sourceUrl) : null;
     record.TryGetValue(Constants.ChangeFeed.EventData.Url, out object url);
     Uri = !string.IsNullOrEmpty((string)url) ? new Uri((string)url) : null;
     record.TryGetValue(Constants.ChangeFeed.EventData.Recursive, out object recursive);
     Recursive = (bool?)recursive;
     Sequencer = (string)record[Constants.ChangeFeed.EventData.Sequencer];
 }
Esempio n. 2
0
 internal BlobChangeFeedEventData(Dictionary <string, object> record)
 {
     BlobOperationName = new BlobOperationName((string)record[Constants.ChangeFeed.EventData.Api]);
     ClientRequestId   = (string)record[Constants.ChangeFeed.EventData.ClientRequestId];
     RequestId         = Guid.Parse((string)record[Constants.ChangeFeed.EventData.RequestId]);
     ETag          = new ETag((string)record[Constants.ChangeFeed.EventData.Etag]);
     ContentType   = (string)record[Constants.ChangeFeed.EventData.ContentType];
     ContentLength = (long)record[Constants.ChangeFeed.EventData.ContentLength];
     BlobType      = ((string)record[Constants.ChangeFeed.EventData.BlobType]) switch
     {
         Constants.ChangeFeed.EventData.BlockBlob => BlobType.Block,
         Constants.ChangeFeed.EventData.PageBlob => BlobType.Page,
         Constants.ChangeFeed.EventData.AppendBlob => BlobType.Append,
         _ => default
     };
     record.TryGetValue(Constants.ChangeFeed.EventData.BlobVersionLower, out object blobVersionObject);
     BlobVersion = (string)blobVersionObject;
     record.TryGetValue(Constants.ChangeFeed.EventData.ContainerVersion, out object containerVersionObject);
     ContainerVersion = (string)containerVersionObject;
     record.TryGetValue(Constants.ChangeFeed.EventData.BlobTier, out object blobTierObject);
     if (blobTierObject != null)
     {
         BlobAccessTier = new AccessTier((string)blobTierObject);
     }
     record.TryGetValue(Constants.ChangeFeed.EventData.ContentOffset, out object contentOffset);
     ContentOffset = (long?)contentOffset;
     record.TryGetValue(Constants.ChangeFeed.EventData.DestinationUrl, out object destinationUrl);
     DestinationUri = !string.IsNullOrEmpty((string)destinationUrl) ? new Uri((string)destinationUrl) : null;
     record.TryGetValue(Constants.ChangeFeed.EventData.SourceUrl, out object sourceUrl);
     SourceUri = !string.IsNullOrEmpty((string)sourceUrl) ? new Uri((string)sourceUrl) : null;
     record.TryGetValue(Constants.ChangeFeed.EventData.Url, out object url);
     Uri = !string.IsNullOrEmpty((string)url) ? new Uri((string)url) : null;
     record.TryGetValue(Constants.ChangeFeed.EventData.Recursive, out object recursive);
     Recursive = (bool?)recursive;
     Sequencer = (string)record[Constants.ChangeFeed.EventData.Sequencer];
     record.TryGetValue(Constants.ChangeFeed.EventData.PreviousInfo, out object previousInfoObject);
     PreviousInfo = ExtractPreviousInfo(record);
     record.TryGetValue(Constants.ChangeFeed.EventData.Snapshot, out object snapshotObject);
     Snapshot = (string)snapshotObject;
     UpdatedBlobProperties = ExtractBlobProperties(record);
     AsyncOperationInfo    = ExtractAsyncOperationInfo(record);
     UpdatedBlobTags       = ExtractUpdatedBlobTags(record);
 }