EF IndexAnnotation included
I would like to define an index in EF modelbuilder that has an included column.
I can add columns that are part of an index like this (via the index annotation ):
base.Property(x => x.Col1).HasColumnAnnotation(
IndexAnnotation.AnnotationName,
new IndexAnnotation(
new IndexAttribute("IX_MyIndex", 1) { IsUnique = false, IsClustered = false }));
base.Property(x => x.Col2).HasColumnAnnotation(
IndexAnnotation.AnnotationName,
new IndexAnnotation(
new IndexAttribute("IX_MyIndex", 2) { IsUnique = false, IsClustered = false }));
but I want to generate something like the following:
CREATE NONCLUSTERED INDEX [MyIndex] ON [MyTable]
(
[Col1] ASC
)
INCLUDE ([Col2])
+3
source to share
No one has answered this question yet
See similar questions:
or similar: