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>

可用于配置索引的 对象。

适用于