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

handle hierarchyid correctly #1450

Merged
merged 1 commit into from
Mar 31, 2022
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 @@ -243,7 +243,7 @@ private void DetermineSqlDbType()
SqlDbType = SqlDbType.NVarChar;
break;
default:
SqlDbType = DataTypeName.EndsWith(".sys.hierarchyid") ? SqlDbType.NVarChar : SqlDbType.Udt;
SqlDbType = DataTypeName.EndsWith(".sys.hierarchyid") ? SqlDbType.Binary : SqlDbType.Udt;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ public async Task GeometryTypeTest()
await ExecuteAndVerifyResult("SELECT geometry::STGeomFromText('POINT (-96.70 40.84)',4326) [Geo]", "0xE6100000010CCDCCCCCCCC2C58C0EC51B81E856B4440");
}

[Test]
public async Task SysnameTypeTest()
{
await ExecuteAndVerifyResult("SELECT CAST('testsysname' AS SYSNAME)", "testsysname");
}

[Test]
public async Task HierarchyIdTypeTest()
{
await ExecuteAndVerifyResult("SELECT CAST(0x58 as hierarchyid)", "0x58");
}

private async Task ExecuteAndVerifyResult(string queryText, string expectedValue)
{
// Given a connection to a live database
Expand Down