Example #1
0
        /// <summary>
        /// Configures services for a given service collection and configuration.
        /// </summary>
        /// <param name="services">Services.</param>
        /// <param name="configuration">Configuration.</param>
        /// <returns><see cref="IServiceCollection"/>.</returns>
        public static IServiceCollection AddAsaphServices(
            this IServiceCollection services, IConfiguration configuration)
        {
            // Get Azure AD B2C configuration
            AzureAdb2cConfiguration azureAdb2CConfiguration = configuration
                                                              .GetSection("AzureAdb2c")
                                                              .Get <AzureAdb2cConfiguration>();

            // Get Dynamo DB configuration
            DynamoDBConfiguration dynamoDBConfiguration = configuration
                                                          .GetSection("DynamoDB")
                                                          .Get <DynamoDBConfiguration>();

            // Register services
            services.AddTransient <
                ISongDirectorRepositoryFragment,
                AzureAdb2cSongDirectorRepository>(
                factory => new(azureAdb2CConfiguration))
            .AddTransient <
                ISongDirectorRepositoryFragment,
                DynamoDBSongDirectorRepository>(
                factory => new(dynamoDBConfiguration))
            .AddTransient <
                IAsyncRepository <SongDirector>,
                AggregateSongDirectorRepository>();

            // Return the service collection reference
            return(services);
        }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                string config = Environment.GetEnvironmentVariable("DynamoDBConfiguration");

                if (string.IsNullOrEmpty(config))
                {
                    throw new Exception("DynamoDBConfiguration not specified.");
                }

                DynamoDBConfiguration dynamoDBConfig = JsonConvert.DeserializeObject <DynamoDBConfiguration>(config);
                DynamoDBOchestration  orchestration  = new DynamoDBOchestration(dynamoDBConfig);
                OrchestrationEngine   engine         = new OrchestrationEngine(orchestration);
                Console.WriteLine("Running orchestration engine...");
                while (true)
                {
                    engine.Run();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
        }
Example #3
0
        // 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();
            string config = Configuration.GetValue <string>("DynamoDBConfiguration");

            DynamoDBConfiguration dynamoDBConfig = JsonConvert.DeserializeObject <DynamoDBConfiguration>(config);

            services.Configure <DynamoDBConfiguration>(x => x.AccessKey       = dynamoDBConfig.AccessKey);
            services.Configure <DynamoDBConfiguration>(x => x.Region          = dynamoDBConfig.Region);
            services.Configure <DynamoDBConfiguration>(x => x.SecretAccessKey = dynamoDBConfig.SecretAccessKey);
        }
 public AdministrationController(IOptions <DynamoDBConfiguration> model)
 {
     _model          = model.Value;
     _administration = new DynamoDBAdministration(_model);
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DynamoDBSongDirectorRepository"/>
 /// class.
 /// </summary>
 /// <param name="configuration">Configuration.</param>
 public DynamoDBSongDirectorRepository(DynamoDBConfiguration configuration) =>
Example #6
0
 public OrchestrationController(IOptions <DynamoDBConfiguration> model)
 {
     _model         = model.Value;
     _orchestration = new DynamoDBOchestration(_model);
 }