static IRepository <CloudTable> GetRepository(string connectionString) { var options = new TableStorageOptions(); var repository = new TableStorageRepository(connectionString, options); return(repository); }
/// <summary> /// Initializes a new instance of the <see cref="PocoTableStore{T, TPartitionKey, TRowKey}" /> class. /// </summary> /// <param name="tableName">Name of the azure storage table.</param> /// <param name="storageConnectionString">The azure storage connection string.</param> /// <param name="partitionProperty">The property to be used as a partition key.</param> /// <param name="rowProperty">The property to be used as a row key.</param> /// <param name="tableStorageOptions">The table storage options.</param> /// <param name="ignoredProperties">The properties that should not be serialized.</param> /// <exception cref="ArgumentNullException">tableName /// or /// storageConnectionString /// or /// partitionProperty /// or /// rowProperty</exception> public PocoTableStore(string tableName, string storageConnectionString, Expression <Func <T, object> > partitionProperty, Expression <Func <T, object> > rowProperty, TableStorageOptions tableStorageOptions = null, params Expression <Func <T, object> >[] ignoredProperties) { if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } if (storageConnectionString == null) { throw new ArgumentNullException(nameof(storageConnectionString)); } if (partitionProperty == null) { throw new ArgumentNullException(nameof(partitionProperty)); } if (rowProperty == null) { throw new ArgumentNullException(nameof(rowProperty)); } _keysConverter = new SimpleKeysConverter <T, TPartitionKey, TRowKey>(partitionProperty, rowProperty, ignoredProperties); tableStorageOptions = tableStorageOptions ?? new TableStorageOptions(); _tableStore = new TableStore <DynamicTableEntity>(tableName, storageConnectionString, tableStorageOptions); }
/// <summary> /// Constructor /// </summary> /// <param name="tableName">The table name</param> /// <param name="storageConnectionString">The connection string</param> /// <param name="options">Table storage options</param> protected TableStoreBase(string tableName, string storageConnectionString, TableStorageOptions options) { if (string.IsNullOrWhiteSpace(tableName)) { throw new ArgumentException("Table name cannot be null or empty", nameof(tableName)); } if (string.IsNullOrWhiteSpace(storageConnectionString)) { throw new ArgumentException("Table connection string cannot be null or empty", nameof(storageConnectionString)); } if (options == null) { throw new ArgumentNullException(nameof(options), "Table storage options cannot be null"); } var validator = new TableStorageOptionsValidator(); validator.ValidateAndThrow(options); OptimisePerformance(storageConnectionString, options); (_cloudTableService, CloudTable) = CreateTableClient(storageConnectionString, tableName, options.Retries, options.RetryWaitTimeInSeconds); _tableName = tableName; if (options.EnsureTableExists) { //if (!TableExists()) //{ CreateTable(); //} } }
public RevisionsController(IOptions <TableStorageOptions> TableStorageConfig, IOptions <AzureAdOptions> AzureAdConfig, IRevisionDataService revisionDataService, IProjectDataService projectDataService, IAzureDevOpsService azureDevOpsService) { this.TableStorageConfig = TableStorageConfig.Value; this.AzureAdConfig = AzureAdConfig.Value; this.RevisionDataService = revisionDataService; this.ProjectDataService = projectDataService; this.AzureDevOpsService = azureDevOpsService; }
/// <summary> /// Settings to improve performance /// </summary> private static void OptimisePerformance(string storageConnectionString, TableStorageOptions options) { var endpoint = ParseConnectionString.GetTableEndpoint(storageConnectionString); var tableServicePoint = ServicePointManager.FindServicePoint(endpoint); tableServicePoint.UseNagleAlgorithm = options.UseNagleAlgorithm; tableServicePoint.Expect100Continue = options.Expect100Continue; tableServicePoint.ConnectionLimit = options.ConnectionLimit; }
public TwitchService(IOptionsMonitor <TwitchOptions> twitchOptions, IOptionsMonitor <TableStorageOptions> tableStorageOptions, IHttpContextAccessor httpContextAccessor, ITwitchHttpClient twitchHttpClient, IStorageService storageService, ILogger <TwitchService> logger) { _twitchOptions = twitchOptions.CurrentValue; _tableStorageOptions = tableStorageOptions.CurrentValue; _httpContextAccessor = httpContextAccessor; _twitchHttpClient = twitchHttpClient; _storageService = storageService; _logger = logger; }
public ImmutableQueryModelTableStorageTests(StorageAccountFixture fixture) { var options = new TableStorageOptions { TableNamePrefix = fixture.ExecutionContext.GetUniqueStorageTablePrefix(), ConnectionString = fixture.Configuration.StorageAccount.ConnectionString }; storage = new ImmutableQueryModelStorage <FakeImmutableQueryModel>(new OptionsMonitorFake <TableStorageOptions>(options)); }
public MutableQueryModelTableStorageTests(StorageAccountFixture fixture) { var options = new TableStorageOptions { QueryChunkSize = SizeOfTheFilterChunk, TableNamePrefix = fixture.ExecutionContext.GetUniqueStorageTablePrefix(), ConnectionString = fixture.Configuration.StorageAccount.ConnectionString }; storage = new MutableQueryModelTableStorage <FakeMutableQueryModel>(new OptionsMonitorFake <TableStorageOptions>(options)); }
public ProcessStoreTests(StorageAccountFixture storageFixture) { var options = new TableStorageOptions { TableNamePrefix = storageFixture.ExecutionContext.GetUniqueStorageTablePrefix(), ConnectionString = storageFixture.Configuration.StorageAccount.ConnectionString }; storage = new ProcessStore <ProcessHandler1>(new OptionsMonitorFake <TableStorageOptions>(options)); fixture = new Fixture(); }
public ProceduresController(IOptions <TableStorageOptions> TableStorageConfig, IProjectDataService projectDataService, IRevisionDataService revisionDataService, IProcedureDataService procedureDataService, IProcedureExecutionDataService procedureExecutionDataService) { this.TableStorageConfig = TableStorageConfig.Value; ProjectDataService = projectDataService; RevisionDataService = revisionDataService; ProcedureDataService = procedureDataService; ProcedureExecutionDataService = procedureExecutionDataService; }
public ReleasesController(IOptions <TableStorageOptions> TableStorageConfig, IOptions <AzureAdOptions> AzureAdConfig, IReleaseDataService releaseDataService, IRevisionDataService revisionDataService, IProjectDataService projectDataService, IAzureDevOpsService azureDevOpsService, IHubContext <Hubs.BroadcastStatusHub> broadcastStatusHubContext) { this.TableStorageConfig = TableStorageConfig.Value; this.AzureAdConfig = AzureAdConfig.Value; this.ReleaseDataService = releaseDataService; this.RevisionDataService = revisionDataService; this.ProjectDataService = projectDataService; this.AzureDevOpsService = azureDevOpsService; this.BroadcastStatusHubContext = broadcastStatusHubContext; }
public void create_table_storage_with_table_options_retries_less_than_1_then_throws_an_exception(int retries) { // Arrange var options = new TableStorageOptions { Retries = retries }; // Act Action act = () => new TableStore <TestTableEntity>("sometable", ConnectionString, options); // Assert act.Should().Throw <ValidationException>() .WithMessage("Validation failed: \r\n -- Retries: 'Retries' must be greater than '0'. Severity: Error"); }
public void create_table_storage_with_table_options_retry_wait_in_seconds_less_than_1_then_throws_an_exception(double retryTime) { // Arrange var options = new TableStorageOptions { RetryWaitTimeInSeconds = retryTime }; // Act Action act = () => new TableStore <TestTableEntity>("sometable", ConnectionString, options); // Assert act.Should().Throw <ValidationException>() .WithMessage("Validation failed: \r\n -- RetryWaitTimeInSeconds: 'Retry Wait Time In Seconds' must be greater than '0'."); }
public ProceduresController(IOptions <TableStorageOptions> TableStorageConfig, IProjectDataService projectDataService, IRevisionDataService revisionDataService, IProcedureDataService procedureDataService, IProcedureExecutionDataService procedureExecutionDataService, IHubContext <Hubs.BroadcastStatusHub> broadcastStatusHubContext) { this.TableStorageConfig = TableStorageConfig.Value; ProjectDataService = projectDataService; RevisionDataService = revisionDataService; ProcedureDataService = procedureDataService; ProcedureExecutionDataService = procedureExecutionDataService; BroadcastStatusHubContext = broadcastStatusHubContext; }
public void create_table_storage_with_table_option_connection_limit_less_than_2_then_throws_an_exception(int connectionLimit) { // Arrange var options = new TableStorageOptions { ConnectionLimit = connectionLimit }; // Act Action act = () => new TableStore <TestTableEntity>("sometable", ConnectionString, options); // Assert act.Should().Throw <ValidationException>() .WithMessage("Validation failed: \r\n -- ConnectionLimit: 'Connection Limit' must be greater than or equal to '2'."); }
public void create_table_storage_with_multiple_invalid_table_options_throws_an_exception_with_all_invalid_entries(int connectionLimit, int retries, double retryTime) { // Arrange var options = new TableStorageOptions { ConnectionLimit = connectionLimit, Retries = retries, RetryWaitTimeInSeconds = retryTime }; // Act Action act = () => new TableStore <TestTableEntity>("sometable", ConnectionString, options); // Assert act.Should().Throw <ValidationException>() .WithMessage("Validation failed: \r\n -- ConnectionLimit: 'Connection Limit' must be greater than or equal to '2'.\r\n -- Retries: 'Retries' must be greater than '0'.\r\n -- RetryWaitTimeInSeconds: 'Retry Wait Time In Seconds' must be greater than '0'."); }
public ReleaseDataService(IOptions <TableStorageOptions> tableStorageOptions) { this.TableStorageConfig = tableStorageOptions.Value; }
public FollowersController(ILogger <FollowersController> logger, IStorageService storageService, IOptionsMonitor <TableStorageOptions> tableStorageOptionsMonitor) { _logger = logger; _storageService = storageService; _tableStorageOptions = tableStorageOptionsMonitor.CurrentValue; }
public LeakedAccountTableStorageRepository(IOptions <TableStorageOptions> options) { _options = options.Value; }
public ITableStoreDynamic CreateTableStore(string tableName, string storageConnectionString, TableStorageOptions options) { return(new TableStoreDynamic(tableName, storageConnectionString, options)); }
public ITableStore <T> CreateTableStore <T>(string tableName, string storageConnectionString, TableStorageOptions options) where T : class, ITableEntity, new() { return(new TableStore <T>(tableName, storageConnectionString, options)); }
// TODO: Double check Azure table config settings to ensure that connection strings/table properties are accurately set within Azure public AzureTableStorageService(IOptionsMonitor <TableStorageOptions> optionsMonitor, ILogger <AzureTableStorageService> logger) { _tableStorageOptions = optionsMonitor.CurrentValue; _logger = logger; _tableClient = CreateTableClient(_tableStorageOptions.ConnectionString); }
public ProcedureExecutionDataService(IOptions <TableStorageOptions> tableStorageOptions) { this.TableStorageConfig = tableStorageOptions.Value; }
public ProjectDataService(IOptions <TableStorageOptions> tableStorageOptions) { this.TableStorageConfig = tableStorageOptions.Value; }
public ProjectsController(IOptions <TableStorageOptions> TableStorageConfig, IProjectDataService projectDataService) { this.TableStorageConfig = TableStorageConfig.Value; this.ProjectDataService = projectDataService; }
public SasKeyStorageRepository(IOptions <TableStorageOptions> options) { _options = options.Value; }
/// <summary> /// Initializes a new instance of the <see cref="PocoTableStore{T, TPartitionKey, TRowKey}" /> class. /// </summary> /// <param name="tableName">Name of the table.</param> /// <param name="storageConnectionString">The storage connection string.</param> /// <param name="keysConverter">The table converter.</param> /// <param name="tableStorageOptions">The table storage options.</param> /// <exception cref="ArgumentNullException">tableName /// or /// storageConnectionString /// or /// tableConverter</exception> public PocoTableStore(string tableName, string storageConnectionString, SimpleKeysConverter <T, TPartitionKey, TRowKey> keysConverter, TableStorageOptions tableStorageOptions = null) { if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } if (storageConnectionString == null) { throw new ArgumentNullException(nameof(storageConnectionString)); } if (keysConverter == null) { throw new ArgumentNullException(nameof(keysConverter)); } _keysConverter = keysConverter; tableStorageOptions = tableStorageOptions ?? new TableStorageOptions(); _tableStore = new TableStore <DynamicTableEntity>(tableName, storageConnectionString, tableStorageOptions); }