How would I map Spatial Data for EF Core 3.x?

LINQPad 6 seems to completely skip spatial data types such as IGeography.

I'm following the official docs from Microsoft:

I'm using the "(Entity Framework Core (multi-provider)" driver in LinqPad 6 Ef Core 3.0
Couldn't get it work on EF Core 2.x either.

Any help on mapping Geography data types automatically would be greatly appreciated.
Thanks in advance!


  • Undocumented, package NetTopologySuite.Core is also required (which I've included).
  • Are you saying that adding NetTopologySuite.Core fixes the problem, or does it make no difference?
  • Adding NetTopologySuite.Core does not fix the problem in LinqPad.
    I believe this is because LinqPad is not referencing the required spatial geography packages NetTopologySuite.Core package and Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite package when creating the custom DBContext for the (Entity Framework Core (multi-provider) option.

    I was able to confirm this by clicking the “Show Assembly Resolution Log”, I didn't see the required package for SQL Server, resulting in EF Core skipping all geography columns.

    According to Microsoft, there’s a separate Spatial Geography package required for each EF Core Provider:
    EF Core Provider Required Spatial NuGet Package
    Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite
    Microsoft.EntityFrameworkCore.Sqlite Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite
    Microsoft.EntityFrameworkCore.InMemory NetTopologySuite
    Npgsql.EntityFrameworkCore.PostgreSQL Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite

    An additional package NetTopologySuite.Core is also required regardless of the EF Core Provider.

    In a Visual Studio project, I was able to successfully scaffold the geography type for SQL Server when I included the Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite
    and NetTopologySuite.Core packages in the project.

    It would be great if LinqPad would automatically include the Spatial Geography packages listed above when using the (Entity Framework Core (multi-provider) option, as it would save us the time from creating a separate project and building a DLL to use spatial data. The Entity Framework Core (multi-provider) option is much more convenient!

    Thanks in advance!
Sign In or Register to comment.