使用ef core 2.2设置postgis时发生异常

时间:2019-09-12 19:42:37

标签: postgresql .net-core postgis ef-core-2.2 nettopologysuite

我已经按照Npsql网站上的所有说明安装和运行带有.NET Entity Framework Core的PostGIS,但是一旦该应用开始运行,我将收到以下异常:

Could not load type 'GeoAPI.NetTopologySuiteBootstrapper' from assembly 'NetTopologySuite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=f580a05016ebada1'.
public class SpatialDbContext : DbContext
{
    public DbSet<TouristAttraction> TouristAttractions { get; set; }
    protected override void OnConfiguring(DbContextOptionsBuilder builder)
    {
        builder.UseNpgsql(@"Connection", o => o.UseNetTopologySuite());
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
        modelBuilder.HasPostgresExtension("postgis");
    }
}

0 个答案:

没有答案