In my .net framework projects I like to have the following in my app.config
<connectionStrings configSource="connections.config" />
with connections.config containing something like
<connectionStrings>
<add name="ApplicationDatabase" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Database=mydatabase;User Id=myuser; PWD=mypassword;" />
</connectionStrings>
Then I don't check connections.config into source code.
I want to use a similar trick with .NET Core, but it makes use of appsettings.json
via
services.AddDbContext<ApiDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("MyDatabase")));
How do I proceed?