共用方式為


OwnedNavigationBuilder<TOwnerEntity,TDependentEntity>.HasIndex 方法

定義

多載

HasIndex(Expression<Func<TDependentEntity,Object>>)

在指定的屬性上設定索引。 如果給定的屬性集上有現有的索引,則會傳回現有的索引以進行設定。

HasIndex(String[])

在指定的屬性上設定索引。 如果給定的屬性集上有現有的索引,則會傳回現有的索引以進行設定。

HasIndex(Expression<Func<TDependentEntity,Object>>)

在指定的屬性上設定索引。 如果給定的屬性集上有現有的索引,則會傳回現有的索引以進行設定。

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

參數

indexExpression
Expression<Func<TDependentEntity,Object>>

Lambda 運算式,表示要包含在索引 blog => blog.Url () 之屬性 () 。

如果索引是由多個屬性所組成,請指定匿名型別,包括屬性 (post => new { post.Title, post.BlogId }) 。

傳回

IndexBuilder<TEntity>
IndexBuilder<TDependentEntity>

物件,可用來設定索引。

適用於

HasIndex(String[])

在指定的屬性上設定索引。 如果給定的屬性集上有現有的索引,則會傳回現有的索引以進行設定。

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> HasIndex (params string[] propertyNames);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TDependentEntity> HasIndex (params string[] propertyNames);
override this.HasIndex : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<'Entity (requires 'Entity : null)>
override this.HasIndex : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<'DependentEntity (requires 'DependentEntity : null)>
Public Overridable Function HasIndex (ParamArray propertyNames As String()) As IndexBuilder(Of TEntity)
Public Overridable Function HasIndex (ParamArray propertyNames As String()) As IndexBuilder(Of TDependentEntity)

參數

propertyNames
String[]

組成索引的屬性名稱。

傳回

IndexBuilder<TEntity>
IndexBuilder<TDependentEntity>

物件,可用來設定索引。

適用於