public UpdateItemHandler(DynamoDbConfiguration configuration, IAwsClientFactory <AmazonDynamoDBClient> clientFactory) { var dynamoClient = clientFactory.GetAwsClient(); _table = Table.LoadTable(dynamoClient, configuration.TableName); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; }); var dynamoDbConfiguration = new DynamoDbConfiguration(); Configuration.GetSection("DynamoDb").Bind(dynamoDbConfiguration); services.AddSingleton(dynamoDbConfiguration); var modelConfiguration = new ModelConfiguration(); Configuration.GetSection("Model").Bind(modelConfiguration); services.AddSingleton(modelConfiguration); services.AddSingleton <IWebsocketsManager, WebsocketsManager>(); services.AddSingleton <IWebsocketsSender, WebsocketsManager>(); services.AddSingleton <IWebsocketsReceiver, RealtimeMessageHandler>(); services.AddSingleton <IModelMapProvider, InMemoryModelMapProvider>(); //services.AddSingleton<IPersistentDataProvider, DynamoDbPersistentDataProvider>(); }
public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddLogging(); services.AddSingleton <ISeriesConfiguration, SeriesConfiguration>(); services.AddSingleton <IDataAggregator, DataAggregator>(); services.AddSingleton <IRangeCreator <AggregatedDataRange>, AggregatedRangeCreator>(); services.AddSingleton <IRangeAccessor <AggregatedDataRange>, AggregatedRangeAccessor>(); services.AddSingleton <IRangeFilteringPolicy <AggregatedDataRange>, AggregateRangeFilteringPolicy>(); services.AddSingleton <IRangeFilterer <AggregatedDataRange>, RangeFilterer <AggregatedDataRange> >(); services.AddSingleton <IRangeJoiner <AggregatedDataRange>, RangeJoiner <AggregatedDataRange> >(); services.AddSingleton <IRangeMerger <AggregatedDataRange>, RangeMerger <AggregatedDataRange> >(); services.AddSingleton <IRangeCreator <TimeRange>, TimeRangeCreator>(); services.AddSingleton <IRangeAccessor <TimeRange>, TimeRangeAccessor>(); services.AddSingleton <IRangeFilteringPolicy <TimeRange>, TimeRangeFilteringPolicy>(); services.AddSingleton <IRangeFilterer <TimeRange>, RangeFilterer <TimeRange> >(); services.AddSingleton <IRangeJoiner <TimeRange>, RangeJoiner <TimeRange> >(); services.AddSingleton <IRangeMerger <TimeRange>, RangeMerger <TimeRange> >(); services.AddSingleton <IRangeCreator <RawDataRange>, RawDataRangeCreator>(); services.AddSingleton <IRangeAccessor <RawDataRange>, RawDataRangeAccessor>(); services.AddSingleton <IRangeFilteringPolicy <RawDataRange>, RawDataRangeFilteringPolicy>(); services.AddSingleton <IRangeFilterer <RawDataRange>, RangeFilterer <RawDataRange> >(); services.AddSingleton <IRangeJoiner <RawDataRange>, RangeJoiner <RawDataRange> >(); services.AddSingleton <IRangeMerger <RawDataRange>, RangeMerger <RawDataRange> >(); //services.AddSingleton<IAttributeDataProviderFactory, AttributeDataProviderFactory>(); services.AddSingleton <ISeriesKnower, SeriesKnower>(); services.AddSingleton <IDataStore, DynamoDbDataStore>(); services.AddSingleton <IDataValidator, DataValidator>(); services.AddSingleton <IModelMapProvider, InMemoryModelMapProvider>(); services.AddSingleton <TripCounterFactory>(); services.AddSingleton(Startup.ModelMap); var seriesSettings = new SeriesSettings(); Configuration.GetSection("Series").Bind(seriesSettings); services.AddSingleton(seriesSettings); var dynamoDbConfiguration = new DynamoDbConfiguration(); Configuration.GetSection("DynamoDB").Bind(dynamoDbConfiguration); services.AddSingleton(dynamoDbConfiguration); var serviceProvider = services.BuildServiceProvider(); var loggerFactory = serviceProvider.GetService <ILoggerFactory>(); loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); return(serviceProvider); }
public NoteDynamoRepository(DynamoDbConfiguration configuration, IAwsClientFactory <AmazonDynamoDBClient> clientFactory) { _client = clientFactory.GetAwsClient(); _configuration = new DynamoDBOperationConfig { OverrideTableName = $"{Environment.GetEnvironmentVariable("stage")}-notes", SkipVersionCheck = true }; }
public ItemDynamoRepository(DynamoDbConfiguration configuration, IAwsClientFactory <AmazonDynamoDBClient> clientFactory) { _client = clientFactory.GetAwsClient(); _configuration = new DynamoDBOperationConfig { OverrideTableName = configuration.TableName, SkipVersionCheck = true }; }
/// <summary> /// Get the Configuration of a selected database with the selected parameters. /// </summary> /// <returns></returns> private IConfiguration GetConfiguration() { IConfiguration extractConf; if (Constants.DatabaseTypeStrings[(int)DatabaseType.JsonExample] == cbDatabaseType.Text) { if (string.IsNullOrWhiteSpace(_jsonFileContent)) { extractConf = new JsonConfiguration(); } else { extractConf = new JsonConfiguration(_jsonFileContent); } } else if (Constants.DatabaseTypeStrings[(int)DatabaseType.MongoDb] == cbDatabaseType.Text) { extractConf = new MondoDbConfiguration(txtMongodbConnectionString.Text, txtMongodbDatabase.Text); } else if (Constants.DatabaseTypeStrings[(int)DatabaseType.DocumentDb] == cbDatabaseType.Text) { extractConf = new DocumentDbConfiguration(txtDocumentdbEndPoint.Text, txtDocumentdbAuthKey.Text, txtDocumentDbDatabase.Text); } else if (Constants.DatabaseTypeStrings[(int)DatabaseType.DynamoDb] == cbDatabaseType.Text) { extractConf = new DynamoDbConfiguration(txtDynamoDbAccessKey.Text, txtDynamoDbSecretKey.Text, txtDynamoDbRegion.Text); } else { MessageBox.Show("Invalid selected database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); extractConf = null; } return(extractConf); }
public DynamoDbTestFixture() { Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", "abc"); Environment.SetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", "def"); _configuration = new DynamoDbConfiguration <TestEntity> { PartitionKey = "PartitionKey", SortKey = "SortKey", TableName = "Test" }; _dynamoDbClient = new AmazonDynamoDBClient(new EnvironmentVariablesAWSCredentials(), new AmazonDynamoDBConfig { UseHttp = true, ServiceURL = "http://localhost:8042/" }); var logger = new Mock <ILogger <DynamoDbRepository <TestEntity> > >(); Repository = new DynamoDbRepository <TestEntity>(_dynamoDbClient, _configuration, logger.Object); }
public DynamoDbRepository(IAmazonDynamoDB dynamoDbClient, DynamoDbConfiguration <TDataModel> configuration, ILogger <DynamoDbRepository <TDataModel> > logger) { _dynamoDbClient = dynamoDbClient; _configuration = configuration; _logger = logger; }