Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework 6 migrations : create index with include columns code first

I'm looking for a way to create an index like this with Entity Framework 6.1:

 CREATE INDEX [IX_MYINDEX] ON [db].[dbo].[Payments] ([IsDeleted])
 INCLUDE ([Id], [InvoiceId], [OrderId])

I've found several other answers saying it can't be done because of the "Include" columns, but all of those answers are from 3 years ago so I wonder if something has been added that would make this into a possibility.

We'd like to avoid (if at all possible) to have real SQL in our code and prefer a real code-first solution where we annotate the Model-classes. I've tried Googling for it and I've spent some time reading different answers on Stackoverflow but can't seem to find the right fit. Can anyone point me in the right direction please?

Thank you very much

like image 653
Steven Lemmens Avatar asked Nov 08 '22 21:11

Steven Lemmens


1 Answers

No, still not possible in EF6 and EF Core

like image 112
ErikEJ Avatar answered Nov 14 '22 22:11

ErikEJ