// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContextPool <ApplicationDbContext>( options => options.UseSqlServer(Configuration.GetConnectionString("ApplicationConnection"), SqlServerOptions => { SqlServerOptions.MigrationsAssembly("DretBlog.Data"); } ) ); services.AddDbContextPool <AuthenticationDbContext>( options => options.UseSqlServer(Configuration.GetConnectionString("AuthenticationConnection"), SqlServerOptions => { SqlServerOptions.MigrationsAssembly("DretBlog.Data"); }) ); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <AuthenticationDbContext>() .AddDefaultTokenProviders(); //delibrate password weakening services.Configure <IdentityOptions>(options => { options.SignIn.RequireConfirmedAccount = false; options.SignIn.RequireConfirmedEmail = false; options.SignIn.RequireConfirmedPhoneNumber = false; options.Password.RequireDigit = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; }); services.AddTransient <IAccountsServices, AccountsServices>(); services.AddScoped <IDashboardServices, DashboardServices>(); services.AddScoped <IPostsServices, PostsServices>(); services.AddScoped <IBlogContentServices, BlogContentServices>(); services.AddControllersWithViews(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContextPool <AuthenticationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), SqlServerOptions => { SqlServerOptions.MigrationsAssembly("Auth.DATA"); })); services.AddIdentity <ApplicationUser, IdentityRole>().AddEntityFrameworkStores <AuthenticationDbContext>().AddDefaultTokenProviders(); services.Configure <IdentityOptions>(options => { options.Password.RequireDigit = false; options.Password.RequiredLength = 6; options.Password.RequireLowercase = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; }); services.AddControllers(); services.AddTransient <IAuthService, AuthService>(); }