Skip to content

Commit 79adbc2

Browse files
authored
Adding the SqlDbTypeExtensions (#2688)
1 parent cf8cc22 commit 79adbc2

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,9 @@
624624
<Compile Include="$(CommonSourceRoot)System\Diagnostics\CodeAnalysis.cs">
625625
<Link>Common\System\Diagnostics\CodeAnalysis.cs</Link>
626626
</Compile>
627+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlDbTypeExtensions.cs">
628+
<Link>Microsoft\Data\SqlDbTypeExtensions.cs</Link>
629+
</Compile>
627630

628631
<Compile Include="Interop\SNINativeMethodWrapper.Common.cs" />
629632
<Compile Include="Microsoft\Data\Common\DbConnectionOptions.cs" />

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@
645645
<Compile Include="$(CommonSourceRoot)\Microsoft\Data\ProviderBase\DbReferenceCollection.cs">
646646
<Link>Microsoft\Data\ProviderBase\DbReferenceCollection.cs</Link>
647647
</Compile>
648+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlDbTypeExtensions.cs">
649+
<Link>Microsoft\Data\SqlDbTypeExtensions.cs</Link>
650+
</Compile>
648651
</ItemGroup>
649652
<ItemGroup>
650653
<Compile Include="Common\src\Microsoft\Data\Common\NameValuePermission.cs" />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Data;
6+
7+
namespace Microsoft.Data
8+
{
9+
/// <summary>
10+
/// Extensions for SqlDbType enum to enable its usage.
11+
/// </summary>
12+
public static class SqlDbTypeExtensions
13+
{
14+
/// <summary>
15+
/// Represents the JSON Data type in SQL Server.
16+
/// </summary>
17+
#if NET9_0_OR_GREATER
18+
public const SqlDbType Json = SqlDbType.Json;
19+
#else
20+
public const SqlDbType Json = (SqlDbType)35;
21+
#endif
22+
}
23+
}

0 commit comments

Comments
 (0)