Value object defining configuration of an Azure storage setup of Data platform server and client. It includes ConnectionString for Azure storage account and also RootBlobContainerName which will be used for this deployment (all data will reside inside)
        /// <summary>
        /// Creates a connection to event store, which can both read and write events.
        /// </summary>
        /// <param name="storageConfiguration">Storage configuration (either local file path
        ///     or <see cref="AzureStoreConfiguration"/>).</param>
        /// <param name="storeId">Id of the store to connect to</param>
        /// <param name="platformServerEndpoint">URL of public server API.</param>
        /// <returns>new instance of the client that can read and write events.</returns>
        public static IRawEventStoreClient ConnectToEventStore(string storageConfiguration, string storeId, string platformServerEndpoint)
        {
            var container = EventStoreId.Parse(storeId);

            AzureStoreConfiguration configuration;

            if (!AzureStoreConfiguration.TryParse(storageConfiguration, out configuration))
            {
                return(new FileEventStoreClient(storageConfiguration, container, platformServerEndpoint));
            }
            return(new AzureEventStoreClient(configuration, container, platformServerEndpoint));
        }
        /// <summary>
        /// Creates a connection to event store, which can only both read and write events.
        /// Platform API connection is not needed.
        /// </summary>
        /// <param name="storageConfiguration">Storage configuration (either local file path
        /// or <see cref="AzureStoreConfiguration"/>)</param>
        /// <param name="storeId">Id of the store to connect to</param>
        /// <returns>new instance of the client that can read events</returns>
        public static IRawEventStoreClient ConnectToEventStoreAsReadOnly(
            string storageConfiguration,
            string storeId)
        {
            var container = EventStoreId.Parse(storeId);
            AzureStoreConfiguration configuration;

            if (!AzureStoreConfiguration.TryParse(storageConfiguration, out configuration))
            {
                return(new FileEventStoreClient(storageConfiguration, container));
            }
            return(new AzureEventStoreClient(configuration, container));
        }
        public static bool TryParse(string source, out AzureStoreConfiguration configuration)
        {
            const StringComparison icic = StringComparison.InvariantCultureIgnoreCase;
            if (source.StartsWith("DefaultEndpointsProtocol=", icic)
                || source.StartsWith("UseDevelopmentStorage=true", icic))
            {
                var parts = source.Split('|');

                string rootBlobContainerName = "dp-store";
                if (parts.Length>1)
                {
                    rootBlobContainerName = parts[1];
                }
                configuration = new AzureStoreConfiguration(parts[0], rootBlobContainerName);
                return true;
            }
            configuration = null;
            return false;
        }
        public static bool TryParse(string source, out AzureStoreConfiguration configuration)
        {
            const StringComparison icic = StringComparison.InvariantCultureIgnoreCase;

            if (source.StartsWith("DefaultEndpointsProtocol=", icic) ||
                source.StartsWith("UseDevelopmentStorage=true", icic))
            {
                var parts = source.Split('|');

                string rootBlobContainerName = "dp-store";
                if (parts.Length > 1)
                {
                    rootBlobContainerName = parts[1];
                }
                configuration = new AzureStoreConfiguration(parts[0], rootBlobContainerName);
                return(true);
            }
            configuration = null;
            return(false);
        }
        /// <summary>
        /// Creates a connection to view storage
        /// </summary>
        /// <param name="storageConfiguration">Storage configuration (either local file path
        /// or <see cref="AzureStoreConfiguration"/>)</param>
        /// <param name="containerName">container name (directory) where to put views</param>
        /// <returns>new instance of the client that can read and write events</returns>
        public static ViewClient ConnectToViewStorage(string storageConfiguration, string containerName)
        {
            AzureStoreConfiguration configuration;

            if (!AzureStoreConfiguration.TryParse(storageConfiguration, out configuration))
            {
                var root = new FileViewRoot(new DirectoryInfo(storageConfiguration));

                var viewClient = new ViewClient(root.GetContainer(containerName), FileActionPolicy);
                viewClient.CreateContainerIfNeeded();
                return(viewClient);
            }
            else
            {
                var account       = CloudStorageAccount.Parse(configuration.ConnectionString);
                var client        = account.CreateCloudBlobClient();
                var viewContainer = new AzureViewRoot(client).GetContainer(configuration.RootBlobContainerName);

                var viewClient = new ViewClient(viewContainer.GetContainer(containerName), AzureActionPolicy);
                viewClient.CreateContainerIfNeeded();
                return(viewClient);
            }
        }