Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var conn = new GetConnection(_config);

            services.AddControllers()
            .AddNewtonsoftJson(options =>
                               options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                               );

            services.AddDbContext <MyContext>(options =>
                                              options.UseSqlServer(conn.applePenConnection()));
            //options.UseSqlServer(_config.GetConnectionString("applePenConnection")));


            services.AddDbContext <manufacture_Context>(options =>
                                                        options.UseSqlServer(conn.manufactureConnection()));
            //options.UseSqlServer(_config.GetConnectionString("manufactureConnection")));
        }