如何在 ASP.NET 样板模板中保持关注点分离并使用空间信息查询?

How to keep separation of concerns in ASP.NET Boilerplate template and use spatial information query?

我在 "Core" 库中使用 ASP.NET Boilerplate 我有这个 class:

public class Post : Entity<Guid>
{
    public Post()
    {
        Id = Guid.NewGuid();
        Hashtags = new HashSet<Hashtag>();
    }
    public string Body { get; set; }
    public Location Location { get; set; }
    public virtual ICollection<Hashtag> Hashtags { get; set; }
}

我搜索并发现 Entity Framework 可以使用 DbGeography class 更好地处理空间数据查询。问题是我不想在核心库中使用 Entity Framework ...

有什么办法吗?

Is there any way around ?

简答:

如果您想使用 EF 库中定义的类型,您需要引用它。

但我认为没有理由不在核心库中引用 EF 库来使用它的类型,如果它无论如何都会被您的应用程序中的其他项目加载的话。
我在这里有大致相同的场景,我的实体项目仅将 EF 引用到 "have access" 到数据注释,但在定义 DbContext 或执行任何初始化或执行的意义上不是 "using" EF查询等不会破坏关注点分离。