Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Databases~
            var dbLoggerFactory = new LoggerFactory(new[] { new SqlLoggerProvider() });

            services.AddDbContext <Common1DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common1").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            PersonalDBShardManager.AddService(services, Configuration, dbLoggerFactory);
            // ~Databases


            DbContextFactory.Initialize(Configuration);

            evolib.VersionChecker.Start();


            var gm = new Matching.GeneralManager();

            gm.Start();
            services.AddSingleton(gm);


            services.AddScoped <evolib.Log.ILogObj, evolib.Log.LogObj>();
            services.AddScoped <Services.IServicePack, Services.ServicePack>();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Databases~
            var dbLoggerFactory = new LoggerFactory(new[] { new SqlLoggerProvider() });

            services.AddDbContext <Common1DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common1").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            services.AddDbContext <Common2DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common2").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            services.AddDbContext <Common3DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common3").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            PersonalDBShardManager.AddService(services, Configuration, dbLoggerFactory);
            // ~Databases


            services.AddSession(opt =>
            {
                opt.Cookie.Name   = "evotool-session-id";
                opt.Cookie.MaxAge = TimeSpan.MaxValue;
            });

            services.AddAutoMapper(typeof(Startup));

            services.AddScoped <evolib.Log.ILogObj, evolib.Log.LogObj>();
            services.AddScoped <Services.IServicePack, Services.ServicePack>();

            services.AddScoped <IAccountService, AccountService>();
            services.AddScoped <IMiscService, MiscService>();
            services.AddScoped <IOpsNoticeService, OpsNoticeService>();
            services.AddScoped <IPlayerService, PlayerService>();
            services.AddScoped <ITranslationService, TranslationService>();
            services.AddScoped <IUnitService, UnitService>();
            services.AddScoped <IVersionService, VersionService>();

            services.AddScoped <IGdprService, GdprService>();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }
Exemple #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Databases~
            var dbLoggerFactory = new LoggerFactory(new[] { new SqlLoggerProvider() });

            services.AddDbContext <Common2DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common2").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            PersonalDBShardManager.AddService(services, Configuration, dbLoggerFactory);
            // ~Databases


            services.AddScoped <evolib.Log.ILogObj, evolib.Log.LogObj>();
            services.AddScoped <Services.IServicePack, Services.ServicePack>();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }
Exemple #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // ----------------------
            // Databases~
            var dbLoggerFactory = new LoggerFactory(new[] { new SqlLoggerProvider() });

            services.AddDbContext <Common1DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common1").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            services.AddDbContext <Common2DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common2").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            services.AddDbContext <Common3DBContext>(opt =>
            {
                opt.UseMySql(Configuration.GetSection("RdbConnections").GetSection("Common3").Value);

                opt.UseLoggerFactory(dbLoggerFactory);
            });
            PersonalDBShardManager.AddService(services, Configuration, dbLoggerFactory);
            // ~Databases
            // ----------------------


            // services.AddDistributedRedisCache(opt =>
            // {
            //  opt.Configuration = Configuration.GetConnectionString("GameCacheConnection");
            //  opt.InstanceName = "EvoGame";
            // });


            //services.AddSession( opt=>
            //{
            //	opt.Cookie.Name = Configuration["Session:CookieName"];
            //});

            DbContextFactory.Initialize(Configuration);


            evolib.VersionChecker.Start();
            evolib.OpsNoticeManager.Start();
            evolib.DisabledMobileSuit.Start();


            //services.AddSingleton<XXXX>(xxxx);
            services.AddScoped <evolib.Log.ILogObj, evolib.Log.LogObj>();
            services.AddScoped <Services.IServicePack, Services.ServicePack>();

            services.Configure <ForwardedHeadersOptions>(opt =>
            {
                opt.ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor;

                //default
                //opt.ForwardLimit = 1;
            });


            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }