-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose Json in SqlDbType #103925
Comments
Tagging subscribers to this area: @DavoudEshtehari, @David-Engel, @JRahnama |
Thanks. Just noting that SqlDbType isn't actually referenced anywhere inside the runtime libraries, and @saurabh500 confirmed that previous versions of SqlClient are confirmed to throw on unknown SqlDbType values, so if a user attempts to use the new SqlDbType.Json with an older SqlClient, we should be safe there. |
Looks good as proposed namespace System.Data
{
// Specifies the SQL Server data type.
public enum SqlDbType
{
Json = 35,
}
} |
Background and motivation
The
System.Data.SqlDbType
enum represents the datatypes supported by SQL Server and is used with SqlParameter to specify the column type to be used in SQL server operations while executionSqlCommand
.With the JSON datatype being supported in SQL Server link There is a need to support the JSON type in Microsoft.Data.SqlClient ADO.Net provider for SQL Server.
The API suggestion is aimed at adding an enum called
Json
with value35
inSqlDbType
.Once this enum is available Microsoft.Data.SqlClient (the SQL Server driver) can then leverage the enum value to allow JSON operations using Microsoft.Data.SqlClient APIs.
The version of Microsoft.Data.SqlClient targeting .Net 9, will be able to use the enum
SqlDbType.Json
to provide JSON support.API Proposal
API Usage
There are parameters / properties in the constructors and APIs, which will be enhanced to support
SqlDbType.Json
SqlParameter
SqlParameterCollection
SqlMetaData
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: