Effort.EF6 的空间 DbGeography 提供程序异常 [找不到可用的空间提供程序。]

Spatial DbGeography Provider exception with Effort.EF6 [No usable spatial provider could be found.]

我正在使用 EF6 开发一个应用程序,我决定将 System.Data.Entity.Spatial.DbGeography 用于我的位置,如下所示

public class Place
{
  public int Id { get; set; }
  public string Name { get; set; }
  public DbGeography Location { get; set; }
} 

当我 运行 我的测试时,我得到以下错误

System.NotImplementedException : No usable spatial provider could be found. In order to use the 'DbGeography' or 'DbGeometry' spatial types the EF provider being used must support spatial types and all prerequisites for the provider must be installed.

PS:我正在使用 Effort 进行测试。

任何建议都会有帮助,谢谢。


2015 年 3 月 4 日编辑:

错误与努力有关。它不支持空间属性 [DbGeography] 我正在寻找一种解决方法,当我解决问题时 post。

更多信息:https://effort.codeplex.com/discussions/471666

鉴于 Effort 不支持 DbGeography 和 tamasflamich 等特殊属性 here:

There is no existing support (not even beta) and I am not planning to start work on this feature anytime soon. Sorry.

我也尝试过使用Highway.Data,但它都不支持。

It does not now, nor will it ever support AdvancedQuery, AdvancedCommand, or AdvancedScalar.

我浏览了我的代码,注意到我只需要一个盒子内的位置,然后我决定停止使用 DbGeography 并自己完成,如下所示:

public class Place
{
  public int Id { get; set; }
  public string Name { get; set; }
  public double Lat { get; set; }
  public double Lng { get; set; }
}

而不是:

public IEnumerable<Church> GetInBox(DbGeography boundingBox)
{
  return All().Where(c => c.Location.Intersects(boundingBox));
}

现在我有了这个:

public IEnumerable<Church> GetInBox(DbGeography boundingBox)
{
  All().Where(c =>
            c.Lat <= nelt &&
            c.Lat >= swlt &&
            c.Lng <= nelng &&
            c.Lng >= swlng
            );
}

这解决了我的问题,但如果 Effort 和 HighwayFramework 支持空间就好了。