SqlServerEntityTypeBuilderExtensions.ForSqlServerHasIndex<TEntity> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 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)
Type Parameters
- TEntity
The entity type being configured.
Parameters
- entityTypeBuilder
- EntityTypeBuilder<TEntity>
The builder for the entity type being configured.
- indexExpression
- Expression<Func<TEntity,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
Entity Framework