Exemplo n.º 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <CrashLiticsDbContext>(options =>
            {
                var conBuilder = new IghanConnectionStringBuilder(
                    Configuration["dbSetting:instance"],
                    Configuration["dbSetting:dbName"],
                    Configuration["dbSetting:userName"],
                    Configuration["dbSetting:password"]);

                options.UseSqlServer(conBuilder.Build());
            });

            services.AddCors(setup =>
            {
                setup.AddDefaultPolicy(builder =>
                {
                    builder.AllowAnyHeader();
                    builder.AllowAnyMethod();
                    builder.AllowAnyOrigin();
                });
            });

            services.AddControllers();
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <SimpleCMSDbContext>(optionBuilder =>
            {
                var conBuilder = new IghanConnectionStringBuilder(
                    Configuration["DbConfig:instance"],
                    Configuration["DbConfig:DbName"],
                    Configuration["DbConfig:User"],
                    Configuration["DbConfig:Pass"]);


                optionBuilder.UseSqlServer(conBuilder.Build());
            });

            services.AddControllersWithViews();
        }