Exemplo n.º 1
0
        private IEnumerator <IAsyncResult> SnapshotBlobImpl(byte[] metadata, IBlobObjectCondition condition, AsyncIteratorContext <DateTime> context)
        {
            IAsyncResult asyncResult = this._storageManager.AsyncProcessor.BeginExecute <DateTime>((TimeSpan param0) => {
                DateTime value;
                StorageStampHelpers.ValidateApplicationMetadata(metadata);
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext())
                    {
                        base.LoadContainer(dbContext);
                        BlockBlob blockBlob         = base.LoadBlockBlob(dbContext);
                        BlobLeaseInfo blobLeaseInfo = new BlobLeaseInfo(blockBlob, DateTime.UtcNow);
                        DbBlobObject.CheckConditionsAndReturnResetRequired(blockBlob, blobLeaseInfo, condition, null, false);
                        DateTime?nullable  = null;
                        DateTime?nullable1 = null;
                        dbContext.SnapshotBlockBlob(blockBlob.AccountName, blockBlob.ContainerName, blockBlob.BlobName, metadata, ref nullable, ref nullable1);
                        transactionScope.Complete();
                        nullable       = new DateTime?(DateTime.SpecifyKind(nullable.Value, DateTimeKind.Utc));
                        this._blob     = blockBlob;
                        this.LeaseInfo = blobLeaseInfo;
                        if (nullable1.HasValue)
                        {
                            this._blob.LastModificationTime = new DateTime?(nullable1.Value);
                        }
                        value = nullable.Value;
                    }
                }
                return(value);
            }, base.Timeout, context.GetResumeCallback(), context.GetResumeState("BlobObject.SnapshotBlobImpl"));

            yield return(asyncResult);

            context.ResultData = this._storageManager.AsyncProcessor.EndExecute <DateTime>(asyncResult);
        }
Exemplo n.º 2
0
        private IEnumerator <IAsyncResult> SetPropertiesImpl(ContainerPropertyNames propertyNames, IContainerCondition condition, AsyncIteratorContext <NoResults> context)
        {
            IAsyncResult asyncResult = this.StorageManager.AsyncProcessor.BeginExecute((TimeSpan remaining) => {
                using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext())
                {
                    Microsoft.WindowsAzure.DevelopmentStorage.Store.QueueContainer applicationMetadata = this.LoadQueueContainer(dbContext);
                    if ((propertyNames & ContainerPropertyNames.ApplicationMetadata) != ContainerPropertyNames.None)
                    {
                        StorageStampHelpers.ValidateApplicationMetadata(this.ApplicationMetadata);
                        applicationMetadata.Metadata = this.ApplicationMetadata;
                    }
                    if ((propertyNames & ContainerPropertyNames.ServiceMetadata) != ContainerPropertyNames.None)
                    {
                        applicationMetadata.ServiceMetadata = ((IContainer)this).ServiceMetadata;
                    }
                    dbContext.SubmitChanges();
                    this._queue = applicationMetadata;
                }
            }, this.Timeout, context.GetResumeCallback(), context.GetResumeState("DbQueueContainer.SetProperties"));

            yield return(asyncResult);

            this.StorageManager.AsyncProcessor.EndExecute(asyncResult);
        }