示例#1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     // Add framework services.
     services.AddMvc();
     services.AddEntityFramework().AddDbContext <WareHouseHelper.DataAccess.Context.WareHouseHelperDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Database")));
     services.AddSession();
     RegisterDependecy.Register(services);
 }
示例#2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            services.AddEntityFramework().AddDbContext <JwtDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Database")));

            RegisterDependecy.Register(services);
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddTransient(typeof(ISessionService <>), typeof(SessionService <>));

            services.AddDistributedMemoryCache();
            services.AddSession();
            services.AddOptions();
            services.Configure <ManagerSettings>(Configuration.GetSection("ManagerSettings"));
            services.Configure <LoggerConfig>(Configuration.GetSection("Logging:Loglevel"));
            services.Configure <EmailServiceCredentials>(Configuration.GetSection("EmailServiceCredentials"));
        }
示例#3
0
        // This method gets called by the runtime. Use this method to add services to the container
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();

            var corsBuilder = new CorsPolicyBuilder();

            corsBuilder.AllowAnyHeader();
            corsBuilder.AllowAnyMethod();
            corsBuilder.AllowAnyOrigin();
            corsBuilder.AllowCredentials();

            services.AddCors(options =>
            {
                options.AddPolicy("AnyOrigin", corsBuilder.Build());
            });

            services.AddEntityFramework().AddDbContext <JwtDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Database")));

            services.Configure <LoggerConfig>(Configuration.GetSection("Logging:Loglevel"));
            services.Configure <EmailServiceCredentials>(Configuration.GetSection("EmailServiceCredentials"));

            RegisterDependecy.Register(services);
        }