我有4个表,所有这些表都链接到我要查询的曾祖父母->孩子,这些表包括:
艾伯特1:很多布伦达1:1克里斯1:很多黛西
sql server management studio执行计划说:
CREATE NONCLUSTERED INDEX[<Name of missing index, sysname,> ] ON
Brenda (ChrisId)
INCLUDE (AlbertId)
如何将其转换为ef core?
我试过的:
builder.Entity<Brenda>().HasIndex(x => new { x.Chris, x.AlbertId}); //errors on Add-Migration
^^哪些错误(可能特定于我的项目),然后尝试:
builder.Entity<Brenda>().HasIndex("AlbertId","ChrisId");
builder.Entity<Brenda>().HasIndex("AlbertId"); // above line wipes this index if I don't put this in
在sql中
CREATE NONCLUSTERED INDEX [IX_Brendas_AlbertId_ChrisId] ON [dbo].[Brendas]
(
[AlbertId] ASC,
[ChrisId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
这似乎不是我要找的,我应该用sql添加索引吗?
暂无答案!
目前还没有任何答案,快来回答吧!