Skip to content

Instantly share code, notes, and snippets.

@HoussemDellai
Last active January 5, 2020 13:31
Show Gist options
  • Save HoussemDellai/06f4774cbb33940be565ec21cc49bf98 to your computer and use it in GitHub Desktop.
Save HoussemDellai/06f4774cbb33940be565ec21cc49bf98 to your computer and use it in GitHub Desktop.
var host = Configuration.GetValue<string>("host");
var database = Configuration.GetValue<string>("database");
var port = Configuration.GetValue<string>("port");
var username = Configuration.GetValue<string>("username");
var password = Configuration.GetValue<string>("password");
var connectionString =
$"Server={host},{port};Database={database};User={username};Password={password};";
services.AddDbContext<ProductsContext>(options =>
options.UseSqlServer(connectionString));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment