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
@@ -1,9 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if _WINDOWS

using System;
using System.Runtime.InteropServices;
using System.Text;
Expand Down Expand Up @@ -101,5 +99,3 @@ unsafe uint SniSecGenClientContextWrapper(
uint SniWriteSyncOverAsync(SNIHandle pConn, SNIPacket pPacket);
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// 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 && _WINDOWS
#if NET

using System;
using System.Runtime.InteropServices;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NETFRAMEWORK && _WINDOWS
#if NETFRAMEWORK

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

#if NETFRAMEWORK && _WINDOWS
#if NETFRAMEWORK

using System;
using System.Runtime.InteropServices;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NETFRAMEWORK && _WINDOWS
#if NETFRAMEWORK

using System;
using System.Runtime.InteropServices;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NETFRAMEWORK && _WINDOWS
#if NETFRAMEWORK

using System;
using System.Runtime.InteropServices;
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 _WINDOWS

using System;
using System.Buffers;
using System.Diagnostics;
Expand Down Expand Up @@ -452,5 +450,3 @@ private static void MarshalConsumerInfo(ConsumerInfo consumerInfo, ref SniConsum
#endregion
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<!--<TargetOs>Windows_NT</TargetOs>-->

<NormalizedTargetOs>$(TargetOs.ToLower())</NormalizedTargetOs>

<!-- NOTE: These constants are prefixed with _ to keep them separate from .NET 5+ precompiler -->
<!-- flags. Those only apply to OS-specific target frameworks, and would interfere here. -->
<DefineConstants Condition="'$(NormalizedTargetOs)' == 'unix'">$(DefineConstants);_UNIX</DefineConstants>
<DefineConstants Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(DefineConstants);_WINDOWS</DefineConstants>
</PropertyGroup>

<!-- Target Frameworks =============================================== -->
Expand Down Expand Up @@ -231,11 +226,11 @@
<!-- Embedded resources ============================================== -->
<ItemGroup>
<!-- Linker directives to replace UseManagedNetworking with a constant if consumer specifies -->
<!-- the app context switch in their csproj. This file only applies to netcore on windows. -->
<!-- the app context switch in their csproj. This file only applies to netcore. -->
<!-- This file does not support pre-processor directives, so it must be conditionally -->
<!-- included into the build. -->
<EmbeddedResource Include="Resources\ILLink.Substitutions.xml"
Condition="'$(NormalizedTargetOs)' == 'windows_nt' AND '$(TargetFramework)' != 'net462'">
Condition="'$(TargetFramework)' != 'net462'">
<LogicalName>ILLink.Substitutions.xml</LogicalName>
</EmbeddedResource>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ public override DataTable GetDataSources()
#if NETFRAMEWORK
return SqlDataSourceEnumeratorNativeHelper.GetDataSources();
#else

#if _UNIX
return SqlDataSourceEnumeratorManagedHelper.GetDataSources();
#else
return SqlClient.LocalAppContextSwitches.UseManagedNetworking
? SqlDataSourceEnumeratorManagedHelper.GetDataSources()
: SqlDataSourceEnumeratorNativeHelper.GetDataSources();
#endif

#endif
}
}
}
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 _WINDOWS

using System;
using System.Data;
using System.Diagnostics;
Expand Down Expand Up @@ -175,5 +173,3 @@ private static DataTable ParseServerEnumString(string serverInstances)
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,9 @@ public override int GetHashCode()

internal static DbConnectionPoolIdentity GetCurrent()
{
#if NETFRAMEWORK
return GetCurrentNative();
#else

#if _UNIX
return GetCurrentManaged();
#else
return LocalAppContextSwitches.UseManagedNetworking
? GetCurrentManaged()
: GetCurrentNative();
#endif

#endif
}

#if NETFRAMEWORK
Expand Down Expand Up @@ -94,7 +84,6 @@ private static DbConnectionPoolIdentity GetCurrentManaged()
return current;
}

#if _WINDOWS
private static DbConnectionPoolIdentity GetCurrentNative()
{
DbConnectionPoolIdentity current;
Expand Down Expand Up @@ -124,7 +113,6 @@ private static DbConnectionPoolIdentity GetCurrentNative()
s_lastIdentity = current;
return current;
}
#endif
}
}

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 _WINDOWS

using System;
using System.Diagnostics;
using System.Globalization;
Expand Down Expand Up @@ -276,7 +274,12 @@ internal static void DemandLocalDbPermissions()
// localDB can also have a format of np:\\.\pipe\LOCALDB#<some number>\tsql\query
internal static string GetLocalDbInstanceNameFromServerName(string serverName)
{
if (serverName is not null)
// LocalDB is only supported on Windows
if (!OsConstants.IsWindows)
{
return null;
}
else if (serverName is not null)
{
// it can start with spaces if specified in quotes
// Memory allocation is reduced by using ReadOnlySpan
Expand All @@ -300,6 +303,12 @@ internal static string GetLocalDbInstanceNameFromServerName(string serverName)

internal static string GetLocalDbMessage(int hrCode)
{
if (!OsConstants.IsWindows)
{
// LocalDB is not available for Unix and hence it cannot be supported.
throw new PlatformNotSupportedException(Strings.LocalDBNotSupported);
}

Debug.Assert(hrCode < 0, "HRCode does not indicate error");
try
{
Expand Down Expand Up @@ -422,5 +431,3 @@ internal InstanceInfo(string version)
#endif
}
}

#endif

This file was deleted.

Comment thread
edwardneal marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.

// @TODO: Introduce polymorphism to remove need for this level of indirection
#if NET && _WINDOWS
#if NET

using System;

Expand All @@ -18,7 +18,6 @@ namespace Microsoft.Data.SqlClient
/// </summary>
/// <remarks>
/// It is a ref struct so that it can only be used to transport the handles and not store them.
/// If you change this type you must also change the version for the other platform.
/// </remarks>
internal readonly ref struct PacketHandle
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if _WINDOWS

using System;
using System.Buffers;
using System.Diagnostics;
Expand Down Expand Up @@ -85,5 +83,3 @@ protected override bool GenerateContext(ReadOnlySpan<byte> incomingBlob, IBuffer
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.

// @TODO: Merge with other implementations (and/or introduce polymorphism to handle this indirection)
#if NET && _WINDOWS
#if NET

namespace Microsoft.Data.SqlClient
{
Expand All @@ -15,7 +15,6 @@ namespace Microsoft.Data.SqlClient
/// </summary>
/// <remarks>
/// It is a ref struct so that it can only be used to transport the handles and not store them.
/// If you change this type you must also change the version for the other platform.
/// </remarks>
internal readonly ref struct SessionHandle
{
Expand Down

This file was deleted.

Loading
Loading