Esempio n. 1
0
 public TableStorageRepositoryFactory(
     ITableStorageQueryBuilder tableStorageQueryBuilder,
     ITableContinuationTokenSerializer tableContinuationTokenSerializer,
     IConnectionStringProvider connectionStringProvider,
     ILoggerFactory loggerFactory,
     IAzureSettings azureSettings)
 {
     _tableStorageQueryBuilder         = tableStorageQueryBuilder;
     _tableContinuationTokenSerializer = tableContinuationTokenSerializer;
     _connectionStringProvider         = connectionStringProvider;
     _loggerFactory = loggerFactory;
     _azureSettings = azureSettings;
 }
        public AsyncTableStorageRepository(
            string connectionString,
            string tableName,
            ITableStorageQueryBuilder tableStorageQueryBuilder,
            ITableContinuationTokenSerializer tableContinuationTokenSerializer,
            ILogger <AsyncTableStorageRepository <T> > logger)
        {
            _tableName = tableName;
            _tableStorageQueryBuilder         = tableStorageQueryBuilder;
            _tableContinuationTokenSerializer = tableContinuationTokenSerializer;
            _logger = logger;

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
            CloudTableClient    tableClient    = storageAccount.CreateCloudTableClient();

            tableClient.DefaultRequestOptions.RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(120), 3);
            _table = tableClient.GetTableReference(tableName);

            _logger?.LogTrace("AsyncTableStorageRepository: created for table {TABLENAME}", tableName);
        }