Document named connection string format
In DbContext in dependency injection for ASP.NET Core it reads:
options => options.UseSqlServer("name=ConnectionStrings:DefaultConnection"));
I couldn't find documentation on the name parameter of this connection string.
Is this a typo or does this connection string parameter exist?
If it exists, I propose to add corresponding explanation about the behaviour of this connection string parameter to, e.g., Connection Strings, or Configuration in ASP.NET Core.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 055bb8db-139d-beb5-61c1-47cf1ea6ea93
- Version Independent ID: b0a3d5ad-b62c-1ff4-386a-f11e350eea0c
- Content: DbContext Lifetime, Configuration, and Initialization - EF Core
- Content Source: entity-framework/core/dbcontext-configuration/index.md
- Product: entity-framework
- Technology: entity-framework-core
- GitHub Login: @ajcvickers
- Microsoft Alias: avickers
If you use this connection string syntax and provide a connection string name that doesn't exist, the following exception is thrown:
System.InvalidOperationException: A named connection string was used, but the name 'x' was not found in the application's configuration. Note that named connection strings are only supported when using 'IConfiguration' and a service provider, such as in a typical ASP.NET Core application. See https://go.microsoft.com/fwlink/?linkid=850912 for more information.
That linked page contains only very minimal information about the name=x syntax. And the C# code sample that is shown after that syntax is mentioned doesn't even use it.
Please expand the documentation. What is the difference between those methods? Which method is preferred?
Related: dotnet/efcore#8641
Fixed in 473282b043408a10b2d8f5797dbfaf258ee28431