4

How to define a property as index column, in EF Model-First?

Five years later when this question had been asked for EF-4.0. Do we still have to manually edit .edmx file to add index? I believe this is a pretty trivial scenario & there must be a better way, isn't it?

Community
  • 1
  • 1
Abhijeet
  • 13,562
  • 26
  • 94
  • 175
  • In 2020 in the edmx editor I still don't see any visual way to specify if a column would be unique or I would want to have an index on it. Very disappointing, this is such a basic thing. – Csaba Toth May 19 '20 at 19:45

1 Answers1

0

Sorry, didn't read the question properly. This applies only to Code First. OP asked about Model-First.

Starting with EF 6.1 you can use the Index attribute. See https://msdn.microsoft.com/en-us/data/jj591583.aspx for details like unique indexes and multicolumn indexes.

Hintham
  • 1,078
  • 10
  • 29