Reputation: 19
I created sqlite database from geography markup language (gml) file using GDAL GMLAS https://gdal.org/en/latest/drivers/vector/gmlas.html, with command ogr2ogr -f SQLite test.sqlite3 GMLAS:C:\file.gml -dsco SPATIALITE=YES -nlt CONVERT_TO_LINEAR -oo EXPOSE_METADATA_LAYERS=YES
and while trying to scaffold Scaffold-DbContext "Data Source=C:\dev\test3.sqlite3" Microsoft.EntityFrameworkCore.Sqlite -OutputDir Models
in entity framework the issue with spatial data occurs Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such module: VirtualKNN2'.
I tried to work around Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite and SQLite3Provider_dynamic_cdecl but with no success. Facing You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init(). I assume this is because of Database First Approach. It's mentioned here https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/custom-versions?tabs=net-cli that u need to configure SQLite3Provider before Microsoft.Data.Sqlite is used in your app, and Microsoft.Data.Sqlite is used while scaffolding. So the question is how to scaffold spatial sqlite database properly?
Upvotes: 0
Views: 80