-
-
Notifications
You must be signed in to change notification settings - Fork 637
Open
Description
EFCore.BulkExtensions 10.0.0
SQL Server 2025 & Azure SQL Server
Note: This is not new behavior in 10.0.0. I've seen the same issue in previous versions.
When using the native JSON type (https://learn.microsoft.com/en-us/sql/t-sql/data-types/json-data-type?view=sql-server-ver17)
Entity:
public class SomeEntity
{
public String? SomeJSON { get; set; }
}
EF Core Entity Config:
modelBuilder.Entity<SomeEntity>(entity =>
{
...
entity .Property(x=> x.SomeJSON)
.HasColumnType("JSON");
...
in the database, the field will be type (json, null)
If you set NULL as the value, during a BulkInsertOrUpdateAsync, it will fail saying:
"The incoming tabular data stream (TDS) protocol stream is incorrect. The stream ended unexpectedly."
So far, the only way I've gotten around it was to use "{}" as the value since that's a valid JSON document.
According to the documentation (link above), the following are all valid:
DECLARE @null JSON = NULL -- valid
DECLARE @object JSON = '{}' -- valid
DECLARE @array JSON = '[]' -- valid
btkho and sveinungf
Metadata
Metadata
Assignees
Labels
No labels