/// <summary> /// Create an instance of the client library for Common Runtime for Applications (CRA) /// </summary> /// <param name="storageConnectionString">Optional storage account to use for CRA metadata, if /// not specified, it will use the appSettings key named StorageConnectionString in app.config</param> /// <param name = "localWorker" >Local worker if any</param> public CRAClientLibrary(IDataProvider dataProvider, CRAWorker localWorker) { _localWorker = localWorker; _blobStorage = dataProvider.GetBlobStorageProvider(); _vertexManager = new VertexTableManager(dataProvider); _shardedVertexTableManager = new ShardedVertexTableManager(dataProvider); _endpointTableManager = new EndpointTableManager(dataProvider); _connectionTableManager = new ConnectionTableManager(dataProvider); this.DataProvider = dataProvider; }
/// <summary> /// Create an instance of the client library for Common Runtime for Applications (CRA) /// </summary> /// <param name="storageConnectionString">Optional storage account to use for CRA metadata, if /// not specified, it will use the appSettings key named StorageConnectionString in app.config</param> /// <param name = "localWorker" >Local worker if any</param> public CRAClientLibrary(string storageConnectionString, CRAWorker localWorker) { _localWorker = localWorker; if (storageConnectionString == "" || storageConnectionString == null) { _storageConnectionString = null; #if !DOTNETCORE _storageConnectionString = ConfigurationManager.AppSettings.Get("AZURE_STORAGE_CONN_STRING"); #endif if (_storageConnectionString == null) { _storageConnectionString = Environment.GetEnvironmentVariable("AZURE_STORAGE_CONN_STRING"); } if (_storageConnectionString == null) { throw new InvalidOperationException("Azure storage connection string not found. Use appSettings in your app.config to provide this using the key AZURE_STORAGE_CONN_STRING, or use the environment variable AZURE_STORAGE_CONN_STRING."); } } else { _storageConnectionString = storageConnectionString; } _storageAccount = CloudStorageAccount.Parse(_storageConnectionString); _blobClient = _storageAccount.CreateCloudBlobClient(); _tableClient = _storageAccount.CreateCloudTableClient(); _vertexTableManager = new VertexTableManager(_storageConnectionString); _shardedVertexTableManager = new ShardedVertexTableManager(_storageConnectionString); _endpointTableManager = new EndpointTableManager(_storageConnectionString); _connectionTableManager = new ConnectionTableManager(_storageConnectionString); _vertexTable = CreateTableIfNotExists("cravertextable"); _connectionTable = CreateTableIfNotExists("craconnectiontable"); }