Search code examples
c#sql-server.net-coreentity-framework-coreef-fluent-api

Specify an index fill factor using Fluent API?


I'm using Entity Framework 7 (.NET Core 1) RC1. I'd like to create some indexes in a Migration. That part is easy enough, but I can't find any examples of how to specify the fill factor for the indexes.

The Context looks something like this:

modelBuilder.Entity<SomeObject>( entity =>
{
    entity.HasIndex( e => e.SomeProperty ).HasName(" IX_SomeObject_SomeProperty" );
}

And the Migration looks something like this:

migrationBuilder.CreateIndex(
    name: "IX_SomeObject_SomeProperty",
    schema: "dbo",
    table: "SomeObject",
    column: "SomeProperty" );

Is this just not supported by Fluent? Will I have to create the index manually in the Migration?


Solution

  • Fill factor is not supported as of EF Core RC1. You can use migrationBuilder.Sql to write manually the create index statement.