Share via


CollectionOwnershipBuilder<TEntity,TDependentEntity>.HasIndex Method

Definition

Configures an index on the specified properties. If there is an existing index on the given set of properties, then the existing index will be returned for configuration.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder HasIndex (System.Linq.Expressions.Expression<Func<TDependentEntity,object>> indexExpression);
override this.HasIndex : System.Linq.Expressions.Expression<Func<'DependentEntity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder
Public Overridable Function HasIndex (indexExpression As Expression(Of Func(Of TDependentEntity, Object))) As IndexBuilder

Parameters

indexExpression
Expression<Func<TDependentEntity,Object>>

A lambda expression representing the property(s) to be included in the index (blog => blog.Url).

If the index is made up of multiple properties then specify an anonymous type including the properties (post => new { post.Title, post.BlogId }).

Returns

An object that can be used to configure the index.

Applies to