Exemple #1
0
        public Startup(IHostingEnvironment env)
        {
            using (var client = new CodeSnippetsDbContext())
            {
                client.Database.EnsureCreated();
            }

            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            Configuration = builder.Build();
        }
 public CodeController(CodeSnippetsDbContext context)
 {
     _context = context;
 }