public static void AddTodoBoardsServices(this IServiceCollection services, IConfigurationRoot configuration) { // Storage settings var accountKey = configuration.GetValue <string>("BoardsApi:Storage:AccountKey"); var accountName = configuration.GetValue <string>("BoardsApi:Storage:AccountName"); var tableStorageSettings = new TableStorageSettings { AccountKey = accountKey, AccountName = accountName, TableName = configuration.GetValue <string>("BoardsApi:Storage:BoardsTableName") }; var boardDeletedQueueSettings = new QueueStorageSettings { AccountKey = accountKey, AccountName = accountName, QueueName = configuration.GetValue <string>("BoardsApi:Storage:BoardDeletedQueueName") }; // Table message queue services.AddTableMessageQueueStorage(boardDeletedQueueSettings); // Board services services.AddSingleton <ITableStorageRepository <BoardEntity> >(serviceProvider => { return(new TableStorageRepository <BoardEntity>(tableStorageSettings)); }); }
public BaseTableStorageService(TableStorageSettings tableStorageSettings) { _tableStorageSettings = tableStorageSettings; var cloudStorageAccount = CloudStorageAccount.Parse(_tableStorageSettings.ConnectionString); _tableClient = cloudStorageAccount.CreateCloudTableClient(); }
public static IPersonalInfoEnrichmentService BuildService(ILogger logger) { var settings = new TableStorageSettings() { ConnectionString = InfrastructureConfiguration.TableStorageConnString }; var initializer = new AzureTableStorageInitializer(settings); var storedPersonalInfoRepo = new AzureTableStorageRepository <StoredPersonalInfo>(initializer, logger); var personLocalStorage = new PersonLocalStorage(storedPersonalInfoRepo); var contextMappingRepo = new AzureTableStorageRepository <ContextMapping>(initializer, logger); var contextMappingLocalStorage = new ContextMappingLocalStorage(contextMappingRepo); var authenticationSettings = new AuthenticationSettings(InfrastructureConfiguration.AuthProviderUri, InfrastructureConfiguration.AuthProviderClient, InfrastructureConfiguration.AuthProviderSecret); var authenticationProvider = new AuthenticationProvider(authenticationSettings); var personalInfoExternalServiceFactory = new PersonalInfoExternalServiceFactory(contextMappingLocalStorage, authenticationProvider, logger); return(new PersonalInfoEnrichmentService(personLocalStorage, personalInfoExternalServiceFactory, logger)); }
public static IAzureTableStorageInitializer InitializeTableStorage() { var settings = new TableStorageSettings() { ConnectionString = InfrastructureConfiguration.TableStorageConnString }; return(new AzureTableStorageInitializer(settings)); }
public void BeforeTests() { settings = new TableStorageSettings() { ConnectionString = "DefaultEndpointsProtocol=https;AccountName=raetgdprtbldev;AccountKey=qqCd1mOJcAU151rMmVtlfEOCthcFV9ae8q3MKYsqj/Cl6sqBXbKHldeSN8FaNCCunHZ17b3TrLObrPhJxSujhA==;EndpointSuffix=core.windows.net" }; initializer = new AzureTableStorageInitializer(settings); }
public TableStorageDexEntryRepository(TableStorageSettings settings) { _table = new Lazy <CloudTable>(() => { var account = CloudStorageAccount.Parse(settings.ConnectionString); var tableClient = account.CreateCloudTableClient(); var table = tableClient.GetTableReference(settings.DexEntriesTableName); table.CreateIfNotExistsAsync().Wait(); return(table); }); }
public static void AddTodoCardsServices(this IServiceCollection services, IConfigurationRoot configuration) { // Table storage settings var tableStorageSettings = new TableStorageSettings { AccountKey = configuration.GetValue <string>("CardsApi:Storage:AccountKey"), AccountName = configuration.GetValue <string>("CardsApi:Storage:AccountName"), TableName = configuration.GetValue <string>("CardsApi:Storage:CardsTableName") }; // Todo services services.AddSingleton <ICardService, CardService>(); services.AddSingleton <ITableStorageRepository <CardEntity> >(serviceProvider => { return(new TableStorageRepository <CardEntity>(tableStorageSettings)); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var azureAdB2CSettings = new AzureAdB2CSettings() { ClientId = Configuration["AzureAdB2C:ClientId"], Tenant = Configuration["AzureAdB2C:Tenant"], Policy = Configuration["AzureAdB2C:Policy"] }; services.AddAuthentication(options => { options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(jwtOptions => { jwtOptions.Authority = $"https://login.microsoftonline.com/tfp/{azureAdB2CSettings.Tenant}/{azureAdB2CSettings.Policy}/v2.0/"; jwtOptions.Audience = azureAdB2CSettings.ClientId; jwtOptions.Events = new JwtBearerEvents { OnAuthenticationFailed = AuthenticationFailed }; }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); var tableStorageSettings = new TableStorageSettings() { ConnectionString = Configuration["TableStorageConfiguration:ConnectionString"] }; services.AddSingleton(tableStorageSettings); var messagingSettings = new IoTHubSettings() { ServiceClientConnectionString = Configuration["Messaging:ServiceClientConnectionString"] }; services.AddSingleton(messagingSettings); services.AddSingleton <ISensorDataService <SensorData>, SensorDataService>(); services.AddSingleton(typeof(ITableStorageService <TemperatureEntity>), typeof(TemperatureTableStorageService)); services.AddSingleton(typeof(ITableStorageService <HumidityEntity>), typeof(HumidityTableStorageService)); services.AddSingleton <IMessagingService, MessagingService>(); AutoMapperConfiguration.Configure(); }
public static void AddUsersWriteServices(this IServiceCollection services, IConfigurationRoot configuration) { // Load table/queue storage info from configs var accountKey = configuration.GetValue <string>("UsersApi:Storage:AccountKey"); var accountName = configuration.GetValue <string>("UsersApi:Storage:AccountName"); var tableStorageSettings = new TableStorageSettings { AccountKey = accountKey, AccountName = accountName, TableName = configuration.GetValue <string>("UsersApi:Storage:UsersWriteTableName") }; // User services services.AddSingleton <IUserOperationQueuesService>(serviceProvider => { var userCreatedQueue = CreateTableMessageQueueStorageRepository(new QueueStorageSettings { AccountKey = accountKey, AccountName = accountName, QueueName = configuration.GetValue <string>("UsersApi:Storage:UserCreatedQueueName") }); var userUpdatedQueue = CreateTableMessageQueueStorageRepository(new QueueStorageSettings { AccountKey = accountKey, AccountName = accountName, QueueName = configuration.GetValue <string>("UsersApi:Storage:UserUpdatedQueueName") }); var userDeletedQueue = CreateTableMessageQueueStorageRepository(new QueueStorageSettings { AccountKey = accountKey, AccountName = accountName, QueueName = configuration.GetValue <string>("UsersApi:Storage:UserDeletedQueueName") }); return(new UserOperationQueuesService(userCreatedQueue, userUpdatedQueue, userDeletedQueue)); }); services.AddSingleton <IUserService, UserService>(); services.AddSingleton <ITableStorageRepository <UserEntity> >(serviceProvider => { return(new TableStorageRepository <UserEntity>(tableStorageSettings)); }); }
public HumidityTableStorageService(TableStorageSettings tableStorageSettings) : base(tableStorageSettings) { }
public static void Main(string[] args) { TableStorageSettings tableStorageSettings = new TableStorageSettings(); MessageServiceRepository repository = new MessageServiceRepository(tableStorageSettings); }
public AzureTableStorage(TableStorageSettings settings) { this.settings = settings; }
public TemperatureTableStorageService(TableStorageSettings tableStorageSettings) : base(tableStorageSettings) { }