public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddDataProtection()
            .PersistKeysToFileSystem(new DirectoryInfo(this.Configuration.GetValue <string>("DataProtection:Keys")))
            .SetApplicationName("DevAdventCalendar");

            ServicesStartup.Configure(services, this.Configuration);

            services
            .RegisterDatabase(this.Configuration)
            .RegisterServices(this.Configuration)
            .AddAutoMapper(typeof(Startup))
            .AddExternalLoginProviders(this.Configuration)
            .AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "QuickApp API", Version = "v1"
                });
            })
            .AddMvc();
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddDefaultPolicy(
                    builder =>
                {
                    builder.AllowAnyOrigin()
                    .AllowAnyHeader()
                    .AllowAnyMethod();
                });
            });

            services.AddControllers().AddNewtonsoftJson(options =>
                                                        options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                                        );

            services.AddSwaggerGen(config =>
            {
                config.SwaggerDoc("v1", new OpenApiInfo
                {
                    Title       = "Air Liquide",
                    Version     = "v1",
                    Description = "Aplicação web teste para desenvolvedor para a empresa Air Liquide"
                });
            });

            services.AddDbContext <AirLiquideDbContext>(options =>
                                                        options.UseSqlServer(Configuration["ConnectionStrings:Connection"])
                                                        );

            RepositoriesStartup.StartupRepositories(services);
            ServicesStartup.StartupServices(services);
        }
Exemple #3
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDataProtection()
            .PersistKeysToFileSystem(new DirectoryInfo(this.Configuration.GetValue <string>("DataProtection:Keys")))
            .SetApplicationName("DevAdventCalendar");

            ServicesStartup.Configure(services, this.Configuration);

            services
            .RegisterDatabase(this.Configuration)
            .RegisterServices(this.Configuration)
            .AddAutoMapper(typeof(Startup))
            .AddExternalLoginProviders(this.Configuration)
            .AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "QuickApp API", Version = "v1"
                });
            })
            .AddMvc();

            services.AddLocalization(o => o.ResourcesPath = "Resources");
            services.ConfigureOptions(this.Configuration);

            services.AddHttpClient();
        }
Exemple #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            ServicesStartup.Configure(app);

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    "default",
                    "{controller=Home}/{action=Vote}/{id?}");
            });
        }
Exemple #5
0
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration = configuration;

            if (env.IsDevelopment())
            {
                this.developmentEnvironment = true;
            }

            identityStartup = new IdentityStartup(configuration, this.developmentEnvironment);
            dataStartup     = new DataStartup();
            apiStartup      = new ApiStartup();
            servicesStartup = new ServicesStartup();
        }
Exemple #6
0
        public void Init(IConfiguration configuration, IWebHostEnvironment env)
        {
            this.Configuration      = configuration;
            this.CurrentEnvironment = env;

            if (env.IsDevelopment())
            {
                this.developmentEnvironment = true;
            }

            identityStartup = new IdentityStartup(configuration, this.developmentEnvironment);
            dataStartup     = new DataStartup();
            apiStartup      = new ApiStartup();
            servicesStartup = new ServicesStartup();
        }
Exemple #7
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     ServicesStartup.ConfigureServices(services, Configuration);
     services.AddControllersWithViews();
 }