EntityTypeBuilder<TEntity>.HasIndex 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.
Overloads
HasIndex(String[], String) |
Configures an index on the specified properties with the given name. If there is an existing index on the given list of properties and with the given name, then the existing index will be returned for configuration. |
HasIndex(Expression<Func<TEntity,Object>>) |
Configures an unnamed index on the specified properties. If there is an existing index on the given list of properties, then the existing index will be returned for configuration. |
HasIndex(String[]) |
Configures an unnamed index on the specified properties. If there is an existing index on the given list of properties, then the existing index will be returned for configuration. |
HasIndex(Expression<Func<TEntity,Object>>, String) |
Configures an index on the specified properties with the given name. If there is an existing index on the given list of properties and with the given name, then the existing index will be returned for configuration. |
HasIndex(String[], String)
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
Configures an index on the specified properties with the given name. If there is an existing index on the given list of properties and with the given name, then the existing index will be returned for configuration.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> HasIndex (string[] propertyNames, string name);
override this.HasIndex : string[] * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function HasIndex (propertyNames As String(), name As String) As IndexBuilder(Of TEntity)
Parameters
- propertyNames
- String[]
The names of the properties that make up the index.
- name
- String
The name to assign to the index.
Returns
An object that can be used to configure the index.
Applies to
HasIndex(Expression<Func<TEntity,Object>>)
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
Configures an unnamed index on the specified properties. If there is an existing index on the given list of properties, then the existing index will be returned for configuration.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder HasIndex (System.Linq.Expressions.Expression<Func<TEntity,object>> indexExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> HasIndex (System.Linq.Expressions.Expression<Func<TEntity,object>> indexExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> HasIndex (System.Linq.Expressions.Expression<Func<TEntity,object?>> indexExpression);
override this.HasIndex : System.Linq.Expressions.Expression<Func<'Entity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder
override this.HasIndex : System.Linq.Expressions.Expression<Func<'Entity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function HasIndex (indexExpression As Expression(Of Func(Of TEntity, Object))) As IndexBuilder
Public Overridable Function HasIndex (indexExpression As Expression(Of Func(Of TEntity, Object))) As IndexBuilder(Of TEntity)
Parameters
- 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
HasIndex(String[])
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
Configures an unnamed index on the specified properties. If there is an existing index on the given list of properties, then the existing index will be returned for configuration.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> HasIndex (params string[] propertyNames);
override this.HasIndex : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function HasIndex (ParamArray propertyNames As String()) As IndexBuilder(Of TEntity)
Parameters
- propertyNames
- String[]
The names of the properties that make up the index.
Returns
An object that can be used to configure the index.
Applies to
HasIndex(Expression<Func<TEntity,Object>>, String)
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
- Source:
- EntityTypeBuilder%60.cs
Configures an index on the specified properties with the given name. If there is an existing index on the given list of properties and with the given name, then the existing index will be returned for configuration.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> HasIndex (System.Linq.Expressions.Expression<Func<TEntity,object>> indexExpression, string name);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<TEntity> HasIndex (System.Linq.Expressions.Expression<Func<TEntity,object?>> indexExpression, string name);
override this.HasIndex : System.Linq.Expressions.Expression<Func<'Entity, obj>> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function HasIndex (indexExpression As Expression(Of Func(Of TEntity, Object)), name As String) As IndexBuilder(Of TEntity)
Parameters
- 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 }
).
- name
- String
The name to assign to the index.
Returns
An object that can be used to configure the index.
Applies to
Entity Framework