ReferenceOwnershipBuilder<TEntity,TRelatedEntity>.HasIndex 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在指定屬性上設定索引。 如果在給定屬性集合上存在現有索引,則該現有索引將被回傳用於配置。
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
參數
- indexExpression
- Expression<Func<TRelatedEntity,Object>>
一個表示要包含在索引中屬性的 lambda 表達式。blog => blog.Url
若索引由多個屬性組成,則指定包含屬性(post => new { post.Title, post.BlogId })的匿名型別。
傳回
一個可以用來設定索引的物件。