Skip to content

Commit

Permalink
Remove NET7_0 usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed May 7, 2024
1 parent a9ee053 commit 035aec1
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class Libraries
internal const string Crypt32 = "crypt32.dll";
internal const string Kernel32 = "kernel32.dll";
internal const string NtDll = "ntdll.dll";
#if !NET7_0_OR_GREATER
#if !NET8_0_OR_GREATER
internal const string SspiCli = "sspicli.dll";
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ internal static bool ValidateSslServerCertificate(string targetServerName, X509C

if (policyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNameMismatch))
{
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
X509Certificate2 cert2 = cert as X509Certificate2;
if (!cert2.MatchesHostname(targetServerName))
{
Expand Down Expand Up @@ -297,7 +297,7 @@ internal static bool ValidateSslServerCertificate(X509Certificate clientCert, X5

if (policyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNameMismatch))
{
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
X509Certificate2 s_cert = serverCert as X509Certificate2;
X509Certificate2 c_cert = clientCert as X509Certificate2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class SNIProxy
private static readonly SNIProxy s_singleton = new SNIProxy();

internal static SNIProxy Instance => s_singleton;
#if !NET7_0_OR_GREATER
#if !NET8_0_OR_GREATER
/// <summary>
/// Generate SSPI context
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ override public string GetName(int i)
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetProviderSpecificFieldType/*' />
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)]
#endif
override public Type GetProviderSpecificFieldType(int i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6146,7 +6146,7 @@ internal bool TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, int length, T
}
else
{
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
value.SqlBinary = SqlBinary.WrapBytes(b);
#else
value.SqlBinary = SqlTypeWorkarounds.SqlBinaryCtor(b, true); // doesn't copy the byte array
Expand Down Expand Up @@ -6443,7 +6443,7 @@ internal bool TryReadSqlValueInternal(SqlBuffer value, byte tdsType, int length,
{
return false;
}
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
value.SqlBinary = SqlBinary.WrapBytes(b);
#else
value.SqlBinary = SqlTypeWorkarounds.SqlBinaryCtor(b, true);
Expand Down Expand Up @@ -7315,7 +7315,7 @@ internal byte[] SerializeSqlDecimal(SqlDecimal d, TdsParserStateObject stateObj)


Span<uint> data = stackalloc uint[4];
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
d.WriteTdsValue(data);
#else
SqlTypeWorkarounds.SqlDecimalExtractData(d, out data[0], out data[1], out data[2], out data[3]);
Expand Down Expand Up @@ -7344,7 +7344,7 @@ internal void WriteSqlDecimal(SqlDecimal d, TdsParserStateObject stateObj)
stateObj.WriteByte(0);

Span<uint> data = stackalloc uint[4];
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
d.WriteTdsValue(data);
#else
SqlTypeWorkarounds.SqlDecimalExtractData(d, out data[0], out data[1], out data[2], out data[3]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private SNIHandle GetSessionSNIHandleHandleOrThrow()
private void ThrowClosedConnection() => throw ADP.ClosedConnectionError();

internal override SSPIContextProvider CreateSSPIContextProvider()
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
=> new NegotiateSSPIContextProvider();
#else
=> new ManagedSSPIContextProvider();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER

using System;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3174,7 +3174,7 @@ private static SqlMoney GetSqlMoney_Unchecked(SmiEventSink_Default sink, ITypedG

long temp = getters.GetInt64(sink, ordinal);
sink.ProcessMessagesAndThrow();
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
return SqlMoney.FromTdsValue(temp);
#else
return SqlTypeWorkarounds.SqlMoneyCtor(temp, 1 /* ignored */ );
Expand Down Expand Up @@ -3658,7 +3658,7 @@ private static void SetSqlMoney_Unchecked(SmiEventSink_Default sink, ITypedSette
sink.ProcessMessagesAndThrow();
}

#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
setters.SetInt64(sink, ordinal, value.GetTdsValue());
#else
setters.SetInt64(sink, ordinal, SqlTypeWorkarounds.SqlMoneyToSqlInternalRepresentation(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ internal SqlMoney SqlMoney
{
return SqlMoney.Null;
}
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
return SqlMoney.FromTdsValue(_value._int64);
#else
return SqlTypeWorkarounds.SqlMoneyCtor(_value._int64, 1/*ignored*/);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public static bool IsTargetReadyForAeWithKeyStore()

public static bool IsSupportingDistributedTransactions()
{
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
return OperatingSystem.IsWindows() && System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture != System.Runtime.InteropServices.Architecture.X86 && IsNotAzureServer();
#elif NETFRAMEWORK
return IsNotAzureServer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Transactions;
using Xunit;

#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER

namespace Microsoft.Data.SqlClient.ManualTesting.Tests
{
Expand Down

0 comments on commit 035aec1

Please sign in to comment.