private static CloudBlobContainer GetApplicationsContainerReference(string connectionString)
        {
            CloudBlobContainer blobContainer = BlobUtils.GetBlobContainer(connectionString,
                                                                          ApplicationsRootFolderName);

            return(blobContainer);
        }
        public static ContainerBuilder RegisterTypes(string deploymentId,
                                                     string instanceId,
                                                     string updateDomain,
                                                     string connectionString,
                                                     string blobContainerName                   = "applications",
                                                     int lockBlobRetryCount                     = 20,
                                                     int lockBlobRetryIntervalInSeconds         = 1,
                                                     int storageExceptionRetryCount             = 20,
                                                     int storageExceptionRetryIntervalInSeconds = 1)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterType <BlobLeaseFactory>().As <IBlobLeaseFactory>().SingleInstance();

            containerBuilder.Register <IUpdateBlobFactory>(c =>
                                                           new UpdateBlobFactoryRetryLockDecorator(
                                                               new UpdateBlobFactory(deploymentId,
                                                                                     BlobUtils.GetBlobContainer(connectionString, blobContainerName),
                                                                                     c.Resolve <IBlobLeaseFactory>()),
                                                               c.ResolveNamed <RetryStrategy>(UpdateBlobFactoryRetryStrategyModuleName)
                                                               )).SingleInstance();

            containerBuilder.Register <RetryStrategy>(
                c => new FixedInterval(lockBlobRetryCount, TimeSpan.FromSeconds(lockBlobRetryIntervalInSeconds)))
            .Named <RetryStrategy>(UpdateBlobFactoryRetryStrategyModuleName).SingleInstance();

            containerBuilder.Register <RetryStrategy>(
                c => new FixedInterval(storageExceptionRetryCount, TimeSpan.FromSeconds(storageExceptionRetryIntervalInSeconds)))
            .Named <RetryStrategy>(UpdateSessionRetryStrategyModuleName).SingleInstance();

            containerBuilder.Register(
                c => new BlobBasedUpdateSessionManager(c.Resolve <IUpdateBlobFactory>(), instanceId, updateDomain));

            containerBuilder.Register <IUpdateSessionManager>(
                c => new UpdateSessionManagerRetryDecorator(
                    c.Resolve <BlobBasedUpdateSessionManager>(),
                    c.ResolveNamed <RetryStrategy>(UpdateSessionRetryStrategyModuleName),
                    new StorageExceptionErrorDetectionStrategy()));
            return(containerBuilder);
        }