Search code examples
c#.net-coreentity-framework-corespatial

What is the equivalent of DbGeography in EF core?


What is the equivalent of DbGeography in EF core?
I want to convert the following code from EF to EF Core:

using System.Data.Entity.Spatial;

namespace Domain
{
    public class City
    {
        public int CityId { get; set; }
        
        public DbGeography Coordinates { get; set; }
    }
}

Solution

  • You have to use NetTopologySuite with EF Core and there is list of libraries which enables that for specific Data Provider: https://learn.microsoft.com/en-us/ef/core/modeling/spatial