好吧,这个问题很清楚。是否可以使用Entity Framework 6.1 Fluent API创建空间索引?
最佳答案
简短的回答-不,不是。我在blogs中看到了切向引用,并且没有发现具体的实现示例。这似乎与以下事实有关:空间索引是过滤后的索引,在Entity Framework中不支持。
为了支持我的答案,我使用最新版本的Entity Framework(6.1)构建了一个POC控制台应用程序。我采取了以下步骤
modelBuilder.Entity<LocationEntity>().Property(t => t.Coordinates).HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("ix_locationentity_coordinates")));
没有创建索引,但应用程序也没有崩溃。我可以尝试对此进行排列,但是我的示例似乎遵循 Entity Framework 的约定:Official Fluent Documentation
关于entity-framework - 如何使用EF 6.1 Fluent API创建空间索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24750207/