c# - 防止在 EF Core 3.1 代码优先中创建非聚集索引
问题描述
在 EF Core 中,默认情况下,它为代码优先方法的外键创建非聚集索引。
我想防止在 EF Core 3.1 中的外键上创建非聚集索引。
在实体框架“经典”(不是核心)中,我可以这样做,就像删除这样的ForeignKeyIndexConvention
约定:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
.....
modelBuilder.Conventions.Remove<ForeignKeyIndexConvention>();
}
但是,我不能在 EF Core 中执行此操作,它不会运行代码。
最好的方法是什么?
解决方案
推荐阅读
- javascript - 使用JQuery获取最后一个输入字段的输入值
- vba - Excel 代码中的应用程序定义或对象定义错误
- react-native - “RCTCustomWebView”的不变违规本机组件不存在
- android - 现在我想使用 ArrayAdapter 将列表视图的特定数据表单显示到另一个列表视图中
- javascript - 我如何删除我输入的最后一个元素,如果我想要所有元素?
- kotlin - How to Resolve Function Template Generics for Signal/Slot System?
- javascript - How do I hide NavBar of my website when using in mobile with reactjs?
- crystal-reports - 将多个列值连接成一个字符串 - Crystal Repot 公式
- python - CV2 问题:numpy.core.multiarray 导入失败
- python - Sorting algorithm based on two conditions