Share via


ReferenceOwnershipBuilder<TEntity,TRelatedEntity>.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<TRelatedEntity,object>> indexExpression);
override this.HasIndex : System.Linq.Expressions.Expression<Func<'RelatedEntity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder
Public Overridable Function HasIndex (indexExpression As Expression(Of Func(Of TRelatedEntity, Object))) As IndexBuilder

Parameters

indexExpression
Expression<Func<TRelatedEntity,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