public override void Initialize( string name, NameValueCollection config )
{
if ( String.IsNullOrEmpty( name ) )
name = "AzureCloudStorageProvider";
if ( config == null )
throw new ArgumentNullException( "config" );
if ( String.IsNullOrEmpty( config["description"] ) )
{
config.Remove( "description" );
config.Add( "description", "Azure Cloud Storage Provider" );
}
base.Initialize( name, config );
this._appName = config["applicationName"];
string connectionStringName = config["connectionStringName"];
if ( string.IsNullOrEmpty( connectionStringName ) )
throw new ProviderException( "Connection string name is not specified" );
this._azureConnectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
if ( string.IsNullOrEmpty( this._azureConnectionString ) )
throw new ProviderException( "Connection string is not found" );
this._containerName = config["containerName"];
if ( string.IsNullOrEmpty( this._containerName ) )
throw new ProviderException( "Container name is not specified" );
this._storageAccount = CloudStorageAccount.Parse( this._azureConnectionString );
this._blobClient = this._storageAccount.CreateCloudBlobClient();
this._container = this._blobClient.GetContainerReference( this.ContainerName );
this._container.CreateIfNotExists();
}