SqlServerEntityTypeBuilderExtensions.ForSqlServerHasIndex<TEntity> 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在指定的屬性上設定索引。 如果給定的屬性集上有現有的索引,則會傳回現有的索引以進行設定。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> ForSqlServerHasIndex<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> entityTypeBuilder, System.Linq.Expressions.Expression<Func<TEntity,object>> indexExpression) where TEntity : class;
static member ForSqlServerHasIndex : Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> * System.Linq.Expressions.Expression<Func<'Entity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function ForSqlServerHasIndex(Of TEntity As Class) (entityTypeBuilder As EntityTypeBuilder(Of TEntity), indexExpression As Expression(Of Func(Of TEntity, Object))) As IndexBuilder(Of TEntity)
類型參數
- TEntity
正在設定的實體型別。
參數
- entityTypeBuilder
- EntityTypeBuilder<TEntity>
要設定之實體類型的產生器。
- indexExpression
- Expression<Func<TEntity,Object>>
Lambda 運算式,表示要包含在索引 blog => blog.Url
() 之屬性 () 。
如果索引是由多個屬性所組成,請指定匿名型別,包括屬性 (post => new { post.Title, post.BlogId }
) 。
傳回
IndexBuilder<TEntity>
物件,可用來設定索引。