Skip to content

HierarchyId

Simon Hughes edited this page Aug 2, 2019 · 18 revisions

Entity Framework Core

If any of your tables uses the SQL HIERARCHYID type, please install the following package:

Install-Package dotMorten.Microsoft.SqlServer.Types

Entity Framework v6

If any of your tables uses the SQL HIERARCHYID type, please install the following package:

Install-Package EntityFrameworkWithHierarchyId

Here is a demo of the AdventureWorks 2012 and 2014 databases which makes use of the HIERARCHYID type: AdventureWorksDemo.zip

Using both HeirarchyId and Table-valued functions

My thanks to Miguel Vrolijk for the following info:

One issue that I’ve encountered is that you can’t use both HierarchyId columns and Table-valued functions as is. You need to compile the CodeFirstStoreFunctions library with the EntityFrameworkWithHierarchyId library instead of the EntityFramework library; the version on NuGet was compiled with the latter.

EF6 v6.3 to have native support for HeirarchyId

My thanks to @sPhinX-LHJ for the following info:

Good news. EF6 support HierarchyId has been added by Gábor Zavarkó on 10 Aug 2018, see here. It's not been released yet on nuget. However, you can have it now if you grab the source code and compile it yourself.

Clone this wiki locally