Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            Log.Logger = _loggerBuilder.Logger();

            AddControllers(services);

            IdentityModelEventSource.ShowPII = true;

            services
            .AddDbContextPool <DatabaseContext>(options =>
                                                options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentityServerSettings(Configuration);

            services
            .AddGoogleAuth(Configuration)
            .AddApplicationServices(Configuration);

            services.AddCors(options =>
            {
                options.AddPolicy(CorsPolicyName, builder => builder
                                  .AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            services.AddAutoMapper(CoreMappings.GetAssembly());
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            Log.Logger = _loggerBuilder.Logger();

            services.AddControllers().AddNewtonsoftJson(o =>
            {
                o.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
            });

            DatabaseConfig.Setup(services, Configuration, Environment);

            services.AddCors(options =>
            {
                options.AddPolicy(CorsPolicyName, builder => builder
                                  .AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(SwaggerConfig.SwaggerGenConfig);

            services
            .AddAutoMapper(CoreMappings.GetAssembly())
            .AddJwtAuth(Configuration)
            .AddClaimPolicies()
            .AddServices(Configuration, Environment)
            .AddCoravelScheduler()
            .HealthCheck(Configuration)
            .SetupMassTransit(
                hostString: new NonNullableString(
                    value: Configuration.GetSection("MessageBroker")["RabbitHost"],
                    paramName: "(\"MessageBroker\")[\"RabbitHost\"]"));
        }
Exemple #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            Log.Logger = _loggerBuilder.Logger();

            services.AddControllers().AddNewtonsoftJson(o =>
            {
                o.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
            });
            services
            .AddDbContextPool <DatabaseContext>(options => options
                                                .UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));

            services.AddCors(options =>
            {
                options.AddPolicy(CorsPolicyName, builder => builder
                                  .AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(SwaggerConfig.SwaggerGenConfig);

            services
            .AddAutoMapper(CoreMappings.GetAssembly())
            .AddJwtAuth(Configuration)
            .AddClaimPolicies()
            .AddServices(Configuration)
            .AddCoravelScheduler();
        }
Exemple #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            Log.Logger = _loggerBuilder.Logger();

            AddControllers(services);

            IdentityModelEventSource.ShowPII = true;
            services.AddHttpContextAccessor();
            services.AddDistributedMemoryCache();
            services.AddSession();

            services
            .AddDbContext <DatabaseContext>(options =>
                                            options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentityServerSettings(Configuration);

            services
            .AddGoogleAuth(Configuration)
            .AddApplicationServices(Configuration);

            services.AddCors(options =>
            {
                options.AddPolicy(CorsPolicyName, builder => builder
                                  .AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            services
            .HealthCheck(Configuration);

            services.AddIdentityMassTransit(Configuration);
        }