Skip to content

Implement support for the new SQL Server native JSON type #32150

@roji

Description

@roji

SQL Azure now has the new JSON type as a public preview (docs); the type will also appear in the next on-premise SQL Server version. We should ensure support for this in EF. We likely want to wait until some sort of on-premise SQL Server supports this.

External things we depend on

  • [ ] We're blocked until we're provided a SqlClient version that supports the new JSON type (tracking issue).
    • We can release without a dependency on the new SqlClient. We just need the SqlDbType value from the BCL.
  • SqlDbType.Json is being exposed in the runtime for .NET 9.0 (issue). EF will presumably need to use that to specify to SqlClient to send the new JSON type.

TODO

  • Implement type mapping support for mapping .NET string to the new json type.
  • Allow users to map primitive collections to the new JSON type (by explicitly configuring the column type - we'll consider switching the default later).
  • Json: add ability to specify type of the json column #28452 (to allow users to map owned entity types to the new JSON type).
  • Test-wise, we'd ideally duplicate the PrimitiveCollections and other JSON-related tests to also execute when configured with json. Though note that the JSON type is currently only available in SQL Azure, and we don't currently test against it, as there's no local emulator version.

/cc @saurabh500

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions