File tree Expand file tree Collapse file tree 3 files changed +30
-8
lines changed
src/EFCore.SqlServer/Storage/Internal
test/EFCore.SqlServer.FunctionalTests/TestUtilities Expand file tree Collapse file tree 3 files changed +30
-8
lines changed Original file line number Diff line number Diff line change @@ -127,8 +127,7 @@ protected override void ConfigureParameter(DbParameter parameter)
127
127
if ( StoreType == "json"
128
128
&& parameter is SqlParameter sqlParameter ) // To avoid crashing wrapping providers
129
129
{
130
- // TODO:SQLJSON Issue #34414
131
- sqlParameter . SqlDbType = ( ( SqlDbType ) 35 ) ;
130
+ sqlParameter . SqlDbType = SqlDbType . Json ;
132
131
}
133
132
134
133
base . ConfigureParameter ( parameter ) ;
Original file line number Diff line number Diff line change @@ -40,8 +40,7 @@ public class SqlServerStringTypeMapping : StringTypeMapping
40
40
/// any release. You should only use it directly in your code with extreme caution and knowing that
41
41
/// doing so can result in application failures when updating to a new Entity Framework Core release.
42
42
/// </summary>
43
- // TODO:SQLJSON Issue #34414
44
- public static SqlServerStringTypeMapping JsonTypeDefault { get ; } = new ( "json" , sqlDbType : ( SqlDbType ) 35 ) ;
43
+ public static SqlServerStringTypeMapping JsonTypeDefault { get ; } = new ( "json" , sqlDbType : SqlDbType . Json ) ;
45
44
46
45
/// <summary>
47
46
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -158,9 +157,8 @@ protected override void ConfigureParameter(DbParameter parameter)
158
157
var value = parameter . Value ;
159
158
var length = ( value as string ) ? . Length ;
160
159
161
- // TODO:SQLJSON Issue #34414
162
160
var sqlDbType = _sqlDbType
163
- ?? ( StoreType == "json" ? ( SqlDbType ) 35 : null ) ;
161
+ ?? ( StoreType == "json" ? SqlDbType . Json : null ) ;
164
162
165
163
if ( sqlDbType . HasValue
166
164
&& parameter is SqlParameter sqlParameter ) // To avoid crashing wrapping providers
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ public static class TestEnvironment
43
43
44
44
private static bool ? _supportsJsonPathExpressions ;
45
45
46
+ private static bool ? _isJsonTypeSupported ;
47
+
46
48
private static bool ? _isVectorTypeSupported ;
47
49
48
50
private static bool ? _supportsFunctions2017 ;
@@ -400,9 +402,32 @@ public static bool IsFunctions2022Supported
400
402
}
401
403
}
402
404
403
- // TODO:SQLJSON Issue #34414
404
405
public static bool IsJsonTypeSupported
405
- => false ;
406
+ {
407
+ get
408
+ {
409
+ if ( ! IsConfigured )
410
+ {
411
+ return false ;
412
+ }
413
+
414
+ if ( _isJsonTypeSupported . HasValue )
415
+ {
416
+ return _isJsonTypeSupported . Value ;
417
+ }
418
+
419
+ try
420
+ {
421
+ _isJsonTypeSupported = GetProductMajorVersion ( ) >= 17 || IsSqlAzure ;
422
+ }
423
+ catch ( PlatformNotSupportedException )
424
+ {
425
+ _isJsonTypeSupported = false ;
426
+ }
427
+
428
+ return _isJsonTypeSupported . Value ;
429
+ }
430
+ }
406
431
407
432
public static bool IsVectorTypeSupported
408
433
{
You can’t perform that action at this time.
0 commit comments