Share via


EntityTypeConfiguration<TEntityType>.HasIndex<TIndex> Method

Definition

Configures index property(s) for this entity type.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public System.Data.Entity.ModelConfiguration.Configuration.IndexConfiguration HasIndex<TIndex> (System.Linq.Expressions.Expression<Func<TEntityType,TIndex>> indexExpression);
member this.HasIndex : System.Linq.Expressions.Expression<Func<'EntityType, 'Index>> -> System.Data.Entity.ModelConfiguration.Configuration.IndexConfiguration
Public Function HasIndex(Of TIndex) (indexExpression As Expression(Of Func(Of TEntityType, TIndex))) As IndexConfiguration

Type Parameters

TIndex

The type of the index.

Parameters

indexExpression
Expression<Func<TEntityType,TIndex>>

A lambda expression representing the property to apply an index to. C#: t => t.Id VB.Net: Function(t) t.Id If the index is made up of multiple properties then specify an anonymous type including the properties. C#: t => new { t.Id1, t.Id2 } VB.Net: Function(t) New With { t.Id1, t.Id2 }

Returns

The IndexConfiguration instance so that the index can be further configured.

Attributes

Applies to