// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //session services.AddDistributedMemoryCache(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(60); options.Cookie.HttpOnly = true; options.Cookie.IsEssential = true; }); // end session services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddDefaultIdentity <IdentityUser>(options => options.SignIn.RequireConfirmedAccount = false) .AddRoles <IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>(); //services.AddAuthentication().AddMicrosoftAccount(microsoftOptions => //{ // microsoftOptions.ClientId = Configuration["Authentication:Microsoft:ClientId"]; // microsoftOptions.ClientSecret = Configuration["Authentication:Microsoft:ClientSecret"]; //}); services.AddControllersWithViews(); services.AddRazorPages(); DependancyContainer.RegisterServices(services, Configuration.GetConnectionString("DefaultConnection")); }
private void RegisterServices(IServiceCollection services) { var moviesCachingTime = TimeSpan.FromSeconds(Convert.ToInt32(Configuration.GetSection("Movies:CachingSeconds").Value)); var initialDataLocation = Configuration.GetSection("Movies:InitialDataLocation").Value; var imageFileRootLocation = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", Configuration.GetSection("Images:Location").Value); var moviesUpdateUrl = Configuration.GetSection("Movies:UpdateUrl").Value; var encoderCodePageNumber = Convert.ToInt32(Configuration.GetSection("Movies:EncoderCodePageNumber").Value); var imageUrlAlias = Configuration.GetSection("Images:UrlAlias").Value; DependancyContainer.RegisterServices(services, initialDataLocation, encoderCodePageNumber, moviesCachingTime, imageFileRootLocation, imageUrlAlias, moviesUpdateUrl); services.AddTransient <IAsyncInitializer, MoviesInitializer>(); DecorateSwagger(services); services.BuildServiceProvider(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddDefaultIdentity <ApplicationUser>(options => { options.SignIn.RequireConfirmedEmail = false; options.Lockout.DefaultLockoutTimeSpan = new TimeSpan(0, 6, 0); options.Password.RequiredLength = 6; }) .AddRoles <IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); services.Configure <IdentityOptions>( options => { options.SignIn.RequireConfirmedEmail = false; }); services.AddAuthentication() .AddGoogle(options => { IConfigurationSection googleAuthNSection = Configuration.GetSection("Authentication:Google"); options.ClientId = googleAuthNSection["ClientId"]; options.ClientSecret = googleAuthNSection["ClientSecret"]; }); // services.AddOptions<IdentityOptions>().Services. services.AddControllersWithViews(); services.AddRazorPages(); DependancyContainer.RegisterServices(services, Configuration.GetConnectionString("DefaultConnection")); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDistributedMemoryCache(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromSeconds(10); options.Cookie.HttpOnly = true; options.Cookie.IsEssential = true; }); services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); /*services.AddDbContext<ApplicationDbContext>(options => * options.UseSqlServer( * Configuration.GetConnectionString("DefaultConnection")));*/ services.AddIdentity <IdentityUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true) .AddDefaultUI() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); services.AddControllersWithViews(); services.AddRazorPages(); services.Configure <IdentityOptions>(options => { options.Password.RequireUppercase = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequiredLength = 5; }); DependancyContainer.RegisterServices(services, Configuration.GetConnectionString("DefaultConnection")); }
private void RegisterServices(IServiceCollection services) { DependancyContainer.RegisterServices(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddDbContext <WorkFlowDbContext>(options => options.UseLazyLoadingProxies().UseSqlServer(Configuration.GetConnectionString("WorkFlowConnection"))); DependancyContainer.RegisterServices(services); }