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 @@ -880,8 +880,8 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\PacketHandle.netcore.Windows.cs">
<Link>Microsoft\Data\SqlClient\PacketHandle.netcore.Windows.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SessionHandle.netcore.Windows.cs">
<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>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlColumnEncryptionCngProvider.Windows.cs">
<Link>Microsoft\Data\SqlClient\SqlColumnEncryptionCngProvider.Windows.cs</Link>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,9 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\Server\SqlSer.cs">
<Link>Microsoft\Data\SqlClient\Server\SqlSer.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SessionHandle.Windows.cs">
<Link>Microsoft\Data\SqlClient\SessionHandle.Windows.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SignatureVerificationCache.cs">
<Link>Microsoft\Data\SqlClient\SignatureVerificationCache.cs</Link>
</Compile>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ internal TdsParserStateObjectNative(TdsParser parser)
{
}

////////////////
// Properties //
////////////////

internal override uint Status => _sessionHandle != null ? _sessionHandle.Status : TdsEnums.SNI_UNINITIALIZED;

internal override SessionHandle SessionHandle => SessionHandle.FromNativeHandle(_sessionHandle);

internal override Guid? SessionId => default;

internal override uint SniGetConnectionId(ref Guid clientConnectionId)
=> SniNativeWrapper.SniGetConnectionId(Handle, ref clientConnectionId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NET

namespace Microsoft.Data.SqlClient
{
// this structure is used for transporting packet handle references between the TdsParserStateObject
Expand All @@ -16,14 +14,16 @@ namespace Microsoft.Data.SqlClient

internal readonly ref struct SessionHandle
{
#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;

#if NET
public SessionHandle(SNI.SNIHandle managedHandle, SNIHandle nativeHandle, int type)
{
Type = type;
Expand All @@ -36,7 +36,15 @@ public SessionHandle(SNI.SNIHandle managedHandle, SNIHandle nativeHandle, int ty
public static SessionHandle FromManagedSession(SNI.SNIHandle managedSessionHandle) => new SessionHandle(managedSessionHandle, default, ManagedHandleType);

public static SessionHandle FromNativeHandle(SNIHandle nativeSessionHandle) => new SessionHandle(default, nativeSessionHandle, NativeHandleType);
}
}
#else
public SessionHandle(SNIHandle nativeHandle)
{
NativeHandle = nativeHandle;
}

public bool IsNull => NativeHandle is null;

public static SessionHandle FromNativeHandle(SNIHandle nativeSessionHandle) => new SessionHandle(nativeSessionHandle);
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ internal readonly ref struct SessionHandle
public const int NativeHandleType = 1;
public const int ManagedHandleType = 2;

public readonly SNI.SNIHandle ManagedHandle;
public readonly int Type;
public readonly SNI.SNIHandle ManagedHandle;

public SessionHandle(SNI.SNIHandle managedHandle, int type)
{
Expand Down
Loading
Loading