Skip to content

jimmymain/EntityFramework.IndexingExtensions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EntityFramework.IndexingExtensions

Indexing Extensions for Entity Framework 6

Installation

PM> Install-Package EntityFramework.IndexingExtensions

Usage

public class MyDataContext : DbContext
{
  protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
    modelBuilder.Entity<Customer>()
        .HasIndex("IX_Customers_Name",          // Provide the index name.
            e => e.Property(x => x.LastName),   // Specify at least one column.
            e => e.Property(x => x.FirstName))  // Multiple columns as desired.

        .HasIndex("IX_Customers_EmailAddress",  // Supports fluent chaining for more indexes.
            IndexOptions.Unique,                // Supports flags for unique and clustered.
            e => e.Property(x => x.EmailAddress)); 
  }
}

Notes

After publishing this, I was informed that there is an active pull request here to add something similar directly into Entity Framework. Therefore, this project will likely be short-lived. Feel free to use it as you like, but I'll probably take it offline after the official version is published.

About

Indexing Extensions for EF6

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%