Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifies support for SqlHierarchyId and Spatial for .NET Core #1848

Merged
merged 1 commit into from Feb 1, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -323,6 +323,7 @@
<PackageReference Include="System.Net.Sockets" Version="$(SystemNetSocketsVersion)" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="$(SystemIdentityModelTokensJwtVersion)" />
<PackageReference Condition="'$(TargetGroup)'=='netfx'" Include="Microsoft.SqlServer.Types" Version="$(MicrosoftSqlServerTypesVersion)" />
<PackageReference Condition="'$(TargetGroup)'=='netcoreapp'" Include="Microsoft.SqlServer.Types" Version="$(MicrosoftSqlServerTypesVersionNet)" />
<PackageReference Condition="'$(TargetGroup)'=='netcoreapp'" Include="Microsoft.DotNet.RemoteExecutor" Version="$(MicrosoftDotnetRemoteExecutorVersion)" />
<PackageReference Condition="'$(TargetGroup)'!='netfx'" Include="System.ServiceProcess.ServiceController" Version="$(SystemServiceProcessServiceControllerVersion)" />
</ItemGroup>
Expand Down
Expand Up @@ -2,20 +2,17 @@
// 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
using System;
using System.Globalization;
using Microsoft.SqlServer.Types;
#else
using System.Collections.ObjectModel;
using System.Data.Common;
#endif
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.Common;
using System.Data.SqlTypes;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Types;
using Xunit;

namespace Microsoft.Data.SqlClient.ManualTesting.Tests
Expand Down Expand Up @@ -49,27 +46,6 @@ public static void GetSchemaTableTest()
}

// Synapse: Parse error at line: 1, column: 48: Incorrect syntax near 'hierarchyid'.
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void GetValueTestThrowsExceptionOnNetCore()
{
using (SqlConnection conn = new SqlConnection(DataTestUtility.TCPConnectionString))
using (SqlCommand cmd = new SqlCommand("select hierarchyid::Parse('/1/') as col0", conn))
{
conn.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
Assert.True(reader.Read());

// SqlHierarchyId is part of Microsoft.SqlServer.Types, which is not supported in Core
Assert.Throws<FileNotFoundException>(() => reader.GetValue(0));
Assert.Throws<FileNotFoundException>(() => reader.GetSqlValue(0));
}
}
}

// Synapse: Parse error at line: 1, column: 48: Incorrect syntax near 'hierarchyid'.
[SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp)]
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void GetValueTest()
{
Expand Down Expand Up @@ -274,7 +250,7 @@ private static void TestUdtSqlDataReaderGetStream(CommandBehavior behavior)
}
}
}
#if NETCOREAPP

// Synapse: Parse error at line: 1, column: 41: Incorrect syntax near 'hierarchyid'.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void TestUdtSchemaMetadata()
Expand Down Expand Up @@ -313,7 +289,7 @@ public static void TestUdtSchemaMetadata()
}
}
}
#endif

// Synapse: Parse error at line: 1, column: 8: Incorrect syntax near 'geometry'.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void TestUdtParameterSetSqlByteValue()
Expand Down Expand Up @@ -411,7 +387,6 @@ private static string ToHexString(byte[] bytes)
return hex.ToString();
}

#if NETFRAMEWORK
private static string GetUdtName(Type udtClrType)
{
if (typeof(SqlHierarchyId) == udtClrType)
Expand Down Expand Up @@ -518,6 +493,5 @@ public static void TestSqlServerTypesInsertAndRead()
DataTestUtility.DropTable(conn, tableName);
}
}
#endif
}
}
1 change: 1 addition & 0 deletions tools/props/Versions.props
Expand Up @@ -78,6 +78,7 @@
<MicrosoftNETCoreRuntimeCoreCLRVersion>2.0.8</MicrosoftNETCoreRuntimeCoreCLRVersion>
<MicrosoftSqlServerSqlManagementObjectsVersion>170.8.0</MicrosoftSqlServerSqlManagementObjectsVersion>
<MicrosoftSqlServerTypesVersion>10.50.1600.1</MicrosoftSqlServerTypesVersion>
<MicrosoftSqlServerTypesVersionNet>160.1000.6</MicrosoftSqlServerTypesVersionNet>
<BenchmarkDotNetVersion>0.13.2</BenchmarkDotNetVersion>
<SystemServiceProcessServiceControllerVersion>6.0.0</SystemServiceProcessServiceControllerVersion>
</PropertyGroup>
Expand Down