From c1fcd936c9164017d59310df94bec80699cd8004 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Mon, 12 Jan 2026 14:27:41 +0100 Subject: [PATCH] Make section about connection string syntax generally visible (#5237) Update UseCompatibilityLevel sample to valid syntax --- entity-framework/core/providers/sql-server/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entity-framework/core/providers/sql-server/index.md b/entity-framework/core/providers/sql-server/index.md index a683a17c84..56d3210ba0 100644 --- a/entity-framework/core/providers/sql-server/index.md +++ b/entity-framework/core/providers/sql-server/index.md @@ -51,8 +51,6 @@ builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("MyContext"))); ``` -The EF SQL Server provider uses [Microsoft.Data.SqlClient](/sql/connect/ado-net/overview-sqlclient-driver) as its underlying ADO.NET provider. For more information on the connection strings accepted by SqlClient, [see this page](/sql/connect/ado-net/connection-string-syntax). - ### [Azure SQL](#tab/azure-sql) ```c# @@ -101,6 +99,8 @@ builder.Services.AddDbContext(options => *** +The EF SQL Server provider uses [Microsoft.Data.SqlClient](/sql/connect/ado-net/overview-sqlclient-driver) as its underlying ADO.NET provider. For more information on the connection strings accepted by SqlClient, [see this page](/sql/connect/ado-net/connection-string-syntax). + ## Compatibility level You can optionally configure EF with the compatibility level of your database; higher compatibility levels allow for newer features, and configuring EF accordingly makes it use those features. If you do not explicitly configure a compatibility level, a reasonable default will be chosen that may not take advantage of the newest features. As a result, it's recommended to explicitly configure the compatibility level you'd like to have. @@ -110,7 +110,7 @@ Note that this only covers EF's own configuration of the compatibility level - a To configure EF with a compatibility level, use `UseCompatibilityLevel()` as follows: ```c# -optionsBuilder.UseSqlServer("", o => o.UseCompatibilityLevel()); +optionsBuilder.UseSqlServer("", o => o.UseCompatibilityLevel(170)); ``` ## Connection resiliency