8000
We read every piece of feedback, and take your input very seriously.
1 parent feec5a7 commit 75d5277Copy full SHA for 75d5277
src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
@@ -881,8 +881,8 @@
881
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\PacketHandle.netcore.Windows.cs">
882
<Link>Microsoft\Data\SqlClient\PacketHandle.netcore.Windows.cs</Link>
883
</Compile>
884
- <Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SessionHandle.netcore.Windows.cs">
885
- <Link>Microsoft\Data\SqlClient\SessionHandle.netcore.Windows.cs</Link>
+ <Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SessionHandle.Windows.cs">
+ <Link>Microsoft\Data\SqlClient\SessionHandle.Windows.cs</Link>
886
887
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlColumnEncryptionCngProvider.Windows.cs">
888
<Link>Microsoft\Data\SqlClient\SqlColumnEncryptionCngProvider.Windows.cs</Link>
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.netcore.cs
src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
@@ -609,6 +609,9 @@
609
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\Server\SqlSer.cs">
610
<Link>Microsoft\Data\SqlClient\Server\SqlSer.cs</Link>
611
612
613
614
+ </Compile>
615
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SignatureVerificationCache.cs">
616
<Link>Microsoft\Data\SqlClient\SignatureVerificationCache.cs</Link>
617
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObject.netfx.cs
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs
@@ -19,6 +19,16 @@ internal TdsParserStateObjectNative(TdsParser parser)
19
{
20
}
21
22
+ ////////////////
23
+ // Properties //
24
25
+
26
+ internal override uint Status => _sessionHandle != null ? _sessionHandle.Status : TdsEnums.SNI_UNINITIALIZED;
27
28
+ internal override SessionHandle SessionHandle => SessionHandle.FromNativeHandle(_sessionHandle);
29
30
+ internal override Guid? SessionId => default;
31
32
internal override uint SniGetConnectionId(ref Guid clientConnectionId)
33
=> SniNativeWrapper.SniGetConnectionId(Handle, ref clientConnectionId);
34
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SessionHandle.netcore.Windows.cs renamed to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SessionHandle.Windows.cs
@@ -2,8 +2,6 @@
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
-#if NET
6
-
7
namespace Microsoft.Data.SqlClient
8
9
// this structure is used for transporting packet handle references between the TdsParserStateObject
@@ -16,14 +14,16 @@ namespace Microsoft.Data.SqlClient
16
14
17
15
internal readonly ref struct SessionHandle
18
+#if NET
public const int NativeHandleType = 1;
public const int ManagedHandleType = 2;
+ public readonly int Type;
public readonly SNI.SNIHandle ManagedHandle;
+#endif
public readonly SNIHandle NativeHandle;
- public readonly int Type;
public SessionHandle(SNI.SNIHandle managedHandle, SNIHandle nativeHandle, int type)
Type = type;
@@ -36,7 +36,15 @@ public SessionHandle(SNI.SNIHandle managedHandle, SNIHandle nativeHandle, int ty
36
public static SessionHandle FromManagedSession(SNI.SNIHandle managedSessionHandle) => new SessionHandle(managedSessionHandle, default, ManagedHandleType);
37
38
public static SessionHandle FromNativeHandle(SNIHandle nativeSessionHandle) => new SessionHandle(default, nativeSessionHandle, NativeHandleType);
39
- }
40
-}
+#else
+ public SessionHandle(SNIHandle nativeHandle)
41
+ {
42
+ NativeHandle = nativeHandle;
43
+ }
44
45
+ public bool IsNull => NativeHandle is null;
46
47
+ public static SessionHandle FromNativeHandle(SNIHandle nativeSessionHandle) => new SessionHandle(nativeSessionHandle);
48
#endif
49
50
+}
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SessionHandle.netcore.Unix.cs
@@ -19,8 +19,8 @@ internal readonly ref struct SessionHandle
- public readonly SNI.SNIHandle ManagedHandle;
public readonly int Type;
+ public readonly SNI.SNIHandle ManagedHandle;
public SessionHandle(SNI.SNIHandle managedHandle, int type)