Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Principal;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Authentication.Cookies;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Identity;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.DependencyInjection;
- using Test.Web.Interfaces;
- using Test.Web.Services;
- namespace Test.Web
- {
- public class Startup
- {
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
- }
- public IConfiguration Configuration { get; }
- // This method gets called by the runtime. Use this method to add services to the container.
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddMvc(options => {
- options.ModelBinderProviders.Insert(0, new CustomBinderProvider());
- });
- services.AddDbContext<ApplicationDbContext>(o =>
- o.UseSqlite(Configuration.GetConnectionString("DefaultConnection")), ServiceLifetime.Scoped);
- services.AddScoped<IUserRepo, UserRepo>();
- services.AddScoped<IRoleRepo, RoleRepo>();
- services.AddSingleton<IUserCache, UserCache>();
- services.AddScoped<ICaptchaVerification, CaptchaVerification>();
- }
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app,
- IHostingEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- }
- else
- {
- app.UseExceptionHandler("/Home/Error");
- }
- app.UseStaticFiles();
- app.UseMvc(routes =>
- {
- routes.MapRoute(
- name: "default",
- template: "{controller=Home}/{action=Index}/{id?}");
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment