Skip to content

Instantly share code, notes, and snippets.

@alexdresko
Created October 4, 2017 13:24
Show Gist options
  • Save alexdresko/866f02d35bfbcfe60c4c4caf4d2fed77 to your computer and use it in GitHub Desktop.
Save alexdresko/866f02d35bfbcfe60c4c4caf4d2fed77 to your computer and use it in GitHub Desktop.
public static IWebHost BuildWebHost(string[] args)
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json");
return WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context, builder) => {
builder.AddEntityFrameworkConfig(options => options.UseSqlServer(config.GetConnectionString("DefaultConnection")));
});
})
.UseStartup<Startup>()
.Build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment