You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,8 @@ CREATE TABLE [Blogs] (
76
76
);
77
77
```
78
78
79
+
Although the new JSON data type is the recommended way to store JSON data in SQL Server going forward, there may be some behavioral differences when transitioning from `nvarchar(max)`, and some specific querying forms may not be supported. For example, SQL Server does not support the DISTINCT operator over JSON arrays, and queries attempting to do so will fail.
80
+
79
81
Note that if you have an existing table and are using <xref:Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseAzureSql*>, upgrading to EF 10 will cause a migration to be generated which alters all existing `nvarchar(max)` JSON columns to `json`. This alter operation is supported and should get applied seamlessly and without any issues, but is a non-trivial change to your database.
80
82
81
83
> [!NOTE]
@@ -87,16 +89,18 @@ The new JSON data type introduced by SQL Server is a superior, 1st-class way to
87
89
88
90
#### Mitigations
89
91
90
-
If you do not wish to transition to the new JSON data type right away, you can configure EF with a compatibility level lower than 170:
92
+
If you are targeting Azure SQL Database and do not wish to transition to the new JSON data type right away, you can configure EF with a compatibility level lower than 170:
As an alternative, you can explicitly set the column type for your properties to be `nvarchar(max)`:
101
+
If you're targeting on-premises SQL Server, the default compatibility level with `UseSqlServer` is currently 150 (SQL Server 2019), so the JSON data type is not used.
102
+
103
+
As an alternative, you can explicitly set the column type on specific properties to be `nvarchar(max)`:
0 commit comments