好的,问题已经很清楚了。使用Entity Framework 6.1 fluent API创建空间索引是否可行?
好的,问题已经很清楚了。使用Entity Framework 6.1 fluent API创建空间索引是否可行?
public partial class V1 : DbMigration
{
public override void Up()
{
Sql("CREATE SPATIAL INDEX [IX_UserProfileAddresses_Location] ON [dbo].[UserProfileAddresses](Location)");
}
public override void Down()
{
Sql("DROP INDEX [IX_UserProfileAddresses_Location] ON [dbo].[UserProfileAddresses]");
}
}
虽然不是最理想的方法,但它仍然遵循了EF的“正常”迁移模式,所以并不算太糟糕。
[Index]
用作DbGeography
的Data Annotations
,则在更新数据库时会出现以下错误:Column 'Area' in table 'dbo.YourTable' is of a type that is invalid for use as a key column in an index or statistics.
- Ogglas