Exemple #1
0
        public Startup(IHostingEnvironment env)
        {
            //appsetting
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

            builder.AddEnvironmentVariables();
            Configuration = builder.Build();

            //初始化映射关系
            DefaultMapper.Initialize();
        }