Skip to content

SQL Server: Support INCLUDE (columnA, columnB...) clause when creating indexes #4846

@OlsonDev

Description

@OlsonDev

I'd like to be able to do something like:

protected override void OnModelCreating(ModelBuilder modelBuilder) {
    modelBuilder.Entity<Foo>()
        .HasIndex(e => new { e.ColumnA })
        .Includes(e => new { e.ColumnB, e.ColumnC })
    ;
}

which would generate a migration that would generate something like:

CREATE NONCLUSTERED INDEX IX_Foo_ColumnA_INCLUDE_ColumnB_ColumnC
ON dbo.Foo (ColumnA)
INCLUDE (ColumnB, ColumnC)
GO

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueThis issue should be relatively straightforward to fix.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions