Entity Framework 6.1: How to change clustered index to another column?

c# entity-framework entity-framework-6

Popular Answer

Your code above (the mapping) specifies that the column has a primary key and a non-clustered index. You then attempt to add a clustered index to another column when the primary key will already be clustered. EntityFamework creates all primary keys as clustered indexes.

According to my understanding, you cannot construct a non-clustered primary key without altering the migration; hence, you would need to do so.

.PrimaryKey(t => t.Id, null, true)
2
6/28/2015 6:17:33 AM


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