Ejemplo n.º 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            var settings = new SimulatorSettings();

            _configuration.Bind(settings);
            settings.Validate();
            services.AddSingleton(_ => settings);

            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddHttpClient();

            services.AddScoped <SasKeyValidator>();
            services.AddSingleton <ValidationIpAddress>();

            services.AddControllers(options => { options.EnableEndpointRouting = false; })
            .AddJsonOptions(options => { options.JsonSerializerOptions.WriteIndented = true; })
            .SetCompatibilityVersion(CompatibilityVersion.Latest);

            services.AddApiVersioning(config =>
            {
                config.DefaultApiVersion = new ApiVersion(DateTime.Parse(Constants.SupportedApiVersion, new ApiVersionFormatProvider()));
                config.AssumeDefaultVersionWhenUnspecified = true;
                config.ReportApiVersions = true;
            });
        }
        public static IServiceCollection AddSimulatorSettings(this IServiceCollection services, IConfiguration configuration)
        {
            var settings = new SimulatorSettings();

            configuration.Bind(settings);
            settings.Validate();
            services.AddSingleton(_ => settings);

            return(services);
        }
        public void ConfigureServices(IServiceCollection services)
        {
            var settings = new SimulatorSettings();

            Configuration.Bind(settings);
            settings.Validate();
            services.AddSingleton(o => settings);

            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddHttpClient();

            services.AddHostedService <SubscriptionValidationService>();
            services.AddSingleton(o => _loggerFactory.CreateLogger(nameof(AzureEventGridSimulator)));
            services.AddScoped <SasKeyValidator>();
            services.AddSingleton <ValidationIpAddress>();

            services.AddMvc(x => x.EnableEndpointRouting = false)
            .SetCompatibilityVersion(CompatibilityVersion.Latest);
        }
        public void ConfigureServices(IServiceCollection services)
        {
            var settings = new SimulatorSettings();

            Configuration.Bind(settings);
            settings.Validate();
            services.AddSingleton(o => settings);

            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddHttpClient();

            services.AddHostedService <SubscriptionValidationService>();
            services.AddSingleton(o => _loggerFactory.CreateLogger(nameof(AzureEventGridSimulator)));
            services.AddScoped <SasKeyValidator>();
            services.AddSingleton <ValidationIpAddress>();
            services.AddSingleton <EventHistory>();

            services.AddControllers().AddNewtonsoftJson();
        }
Ejemplo n.º 5
0
        public void ConfigureServices(IServiceCollection services)
        {
            var settings = new SimulatorSettings();

            _configuration.Bind(settings);
            settings.Validate();
            services.AddSingleton(o => settings);

            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddHttpClient();

            services.AddScoped <SasKeyValidator>();
            services.AddSingleton <ValidationIpAddress>();

            services.AddControllers(options => options.EnableEndpointRouting = false)
            .AddJsonOptions(options =>
            {
                options.JsonSerializerOptions.WriteIndented = true;
            })
            .SetCompatibilityVersion(CompatibilityVersion.Latest);
        }