Reputation: 146
I'm experimenting with .net core, entity framework and sqlserver, i thought the hierarchyID is a perfect datatype for what i'm trying to model. But when i scaffolded the database, EFC was not able to map the hierarchy.
Could not find type mapping for column 'dbo.ingredient.hierarchy_id' with data type 'hierarchyid'. Skipping column.
Could not scaffold the primary key for 'dbo.ingredient'. The following columns in the primary key could not be scaffolded: hierarchy_id.
Unable to generate entity type for table 'dbo.ingredient'.
Could not find type mapping for column 'dbo.ingredient_location.ingredient_id' with data type 'hierarchyid'. Skipping column.
Could not find type mapping for column 'dbo.locations.location' with data type 'geography'. Skipping column.
Could not find type mapping for column 'dbo.pantry_ingredient.ingredient_id' with data type 'hierarchyid'. Skipping column.
Should I drop the idea to use that data type or there is a work around?
I looked for some solutions but all of them require to write the scaffolding by hand and i'm not confident enough at the moment to do so
Upvotes: 7
Views: 6053
Reputation: 81
I had the same problem. My project used all Microsoft libraries version 3.1.4 and MySQL.Data version 8.0.22 and MySQL.Data.EntityFrameworkCore version 8.0.22 Luckily enough I had a very similar project build earlier which used Microsoft libraries version 3.1.4 and MySQL.Data version 8.0.20 and MySQL.Data.EntityFrameworkCore version 8.0.20 Once I switched back the MySQL libraries back to version 8.0.20 Scaffolding worked just fine.
I guess just conflicting libs or versions 8.0.22 have some bugs.
Upvotes: 8
Reputation: 111
you need to install nuget Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite for hanving support to geometry functionality.
Upvotes: 11