Creating indexes with Entity Framework 6 Migrations

ef-code-first entity-framework entity-framework-6 indexing sql-server-2012

Question

Is it possible to create an index using Entity Framework Code First Migrations in an MS SQL Server database if the index needs to be:

  • lowering at least one column
  • adding additional columns
?

It must result in the following:

CREATE NONCLUSTERED INDEX [IX_IndexName] ON [dbo].[TableName]
(
    [Column1] ASC,
    [Column2] DESC
)
INCLUDE ([Column3], [Column4])

On this subject, I discovered in a piece, however it provides a somewhat laborious solution. It's possible that anything has changed since the article was written.

Although I am aware that I can force my migration to run any SQL code, I really want to be able to use any variant ofCreateIndex instead of writing SQL code myself, I can use a technique that handles all the grunt work for me.

1
8
10/14/2015 7:16:38 AM

Popular Answer

ZZZ_tmp
4
1/4/2016 4:49:54 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow