A connection string specifies how an application connects to a data source. In ASP.NET Core, store it as a named value under the `ConnectionStrings` object in `appsettings.json`, then retrieve it through configuration when setting up a database service. section 7.2.2 section 7.2.4
Listing 7.15 Adding a configuration setting in the appsettings.json file in the SportsStore folder
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"SportsStoreConnection": "Server=(localdb)\\MSSQLLocalDB;Database=
SportsStore;MultipleActiveResultSets=true"
}
}
This LocalDB example stores a named SQL Server connection string in JSON. Keep the actual value on one unbroken line; line breaks in printed examples are for layout. section 7.2.2
Configure Entity Framework Core with the matching configuration key and database provider, such as `UseSqlServer` with `ConnectionStrings:SportsStoreConnection`. Connection-string formats vary by database server. The `MultipleActiveResultSets` option is used in examples where queries require multiple result sets. section 7.2.4 section 17.5.3






