示例#1
0
        //public IConfiguration Configuration1 { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <employmentEntities>(
                MySQLDbContextOptionsBuilder => MySQLDbContextOptionsBuilder.UseMySQL(Configuration.GetConnectionString("cs"))
                );

            /*services.AddDbContext<employmentEntities>(
             *  options => options
             *  .UseMySQL(Configuration.GetConnectionString("cs"))
             *  );*/
            //services.AddDbContext<employmentEntities>(
            //options => options.UseMySQL(Configuration1.GetConnectionString(ConfigurationManager.ConnectionStrings["cs"].ConnectionString)));

            /*services.Configure<ForwardedHeadersOptions>(options =>
             * {
             *  options.KnownProxies.Add(IPAddress.Parse("192.168.0.19"));
             * });*/

            /*services.AddAuthentication().AddGoogle(options =>
             * {
             *  IConfigurationSection googleAuthNSection =
             *      Configuration.GetSection("Authentication:Google");
             *
             *  options.ClientId = googleAuthNSection["ClientId"];
             *  options.ClientSecret = googleAuthNSection["ClientSecret"];
             * });*/
            //services.AddSingleton<userinterface,userservices>();
            //services.AddMvcCore().AddAuthorization().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
        public static void GetSqlServerOptions(MySQLDbContextOptionsBuilder builder)
        {
            builder
            .MigrationsAssembly("StarCitizen.Gimp.Web");

            /*.EnableRetryOnFailure
             * (
             *  5,
             *  TimeSpan.FromSeconds(30d),
             *  null
             * );*/
        }