Skip to content

Commit

Permalink
Verifies support for SqlHierarchyId and Spatial for .NET Core
Browse files Browse the repository at this point in the history
(on Windows anyway, more platform in the works I have been told)

fixes dotnet#322

fixes dotnet#30
  • Loading branch information
ErikEJ committed Nov 23, 2022
1 parent 03f3053 commit ad30d47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@ create table {tableName}
DataTestUtility.DropTable(conn, tableName);
}
}
#endif
}
}
1 change: 1 addition & 0 deletions tools/props/Versions.props
Original file line number Diff line number Diff line change
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

0 comments on commit ad30d47

Please sign in to comment.