Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ protected override void ConfigureParameter(DbParameter parameter)
if (StoreType == "json"
&& parameter is SqlParameter sqlParameter) // To avoid crashing wrapping providers
{
// TODO:SQLJSON Issue #34414
sqlParameter.SqlDbType = ((SqlDbType)35);
sqlParameter.SqlDbType = SqlDbType.Json;
}

base.ConfigureParameter(parameter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public class SqlServerStringTypeMapping : StringTypeMapping
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
// TODO:SQLJSON Issue #34414
public static SqlServerStringTypeMapping JsonTypeDefault { get; } = new("json", sqlDbType: (SqlDbType)35);
public static SqlServerStringTypeMapping JsonTypeDefault { get; } = new("json", sqlDbType: SqlDbType.Json);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down Expand Up @@ -158,9 +157,8 @@ protected override void ConfigureParameter(DbParameter parameter)
var value = parameter.Value;
var length = (value as string)?.Length;

// TODO:SQLJSON Issue #34414
var sqlDbType = _sqlDbType
?? (StoreType == "json" ? (SqlDbType)35 : null);
?? (StoreType == "json" ? SqlDbType.Json : null);

if (sqlDbType.HasValue
&& parameter is SqlParameter sqlParameter) // To avoid crashing wrapping providers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public static class TestEnvironment

private static bool? _supportsJsonPathExpressions;

private static bool? _isJsonTypeSupported;

private static bool? _isVectorTypeSupported;

private static bool? _supportsFunctions2017;
Expand Down Expand Up @@ -400,9 +402,32 @@ public static bool IsFunctions2022Supported
}
}

// TODO:SQLJSON Issue #34414
public static bool IsJsonTypeSupported
=> false;
{
get
{
if (!IsConfigured)
{
return false;
}

if (_isJsonTypeSupported.HasValue)
{
return _isJsonTypeSupported.Value;
}

try
{
_isJsonTypeSupported = GetProductMajorVersion() >= 17 || IsSqlAzure;
}
catch (PlatformNotSupportedException)
{
_isJsonTypeSupported = false;
}

return _isJsonTypeSupported.Value;
}
}

public static bool IsVectorTypeSupported
{
Expand Down