Class NpgsqlIndexBuilderExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Npgsql.EntityFrameworkCore.PostgreSQL.dll
Npgsql specific extension methods for IndexBuilder.
public static class NpgsqlIndexBuilderExtensions
- Inheritance
-
NpgsqlIndexBuilderExtensions
- Inherited Members
Methods
AreNullsDistinct(IConventionIndexBuilder, bool, bool)
Specifies whether for a unique index, null values should be considered distinct (not equal). The default is that they are distinct, so that a unique index could contain multiple null values in a column.
public static IConventionIndexBuilder? AreNullsDistinct(this IConventionIndexBuilder indexBuilder, bool nullsDistinct = true, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
nullsDistinct
boolWhether nulls should be considered distinct.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
A builder to further configure the index.
Remarks
AreNullsDistinct(IndexBuilder, bool)
Specifies whether for a unique index, null values should be considered distinct (not equal). The default is that they are distinct, so that a unique index could contain multiple null values in a column.
public static IndexBuilder AreNullsDistinct(this IndexBuilder indexBuilder, bool nullsDistinct = true)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
nullsDistinct
boolWhether nulls should be considered distinct.
Returns
- IndexBuilder
A builder to further configure the index.
Remarks
AreNullsDistinct<TEntity>(IndexBuilder<TEntity>, bool)
Specifies whether for a unique index, null values should be considered distinct (not equal). The default is that they are distinct, so that a unique index could contain multiple null values in a column.
public static IndexBuilder<TEntity> AreNullsDistinct<TEntity>(this IndexBuilder<TEntity> indexBuilder, bool nullsDistinct = true)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
nullsDistinct
boolWhether nulls should be considered distinct.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
Remarks
CanSetAreNullsDistinct(IConventionIndexBuilder, bool, bool)
Specifies whether for a unique index, null values should be considered distinct (not equal). The default is that they are distinct, so that a unique index could contain multiple null values in a column.
public static bool CanSetAreNullsDistinct(this IConventionIndexBuilder indexBuilder, bool nullsDistinct = true, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
nullsDistinct
boolWhether nulls should be considered distinct.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the index can be configured with the method
Remarks
CanSetCollation(IConventionIndexBuilder, IReadOnlyList<string>?, bool)
Returns a value indicating whether the PostgreSQL index collation can be set.
public static bool CanSetCollation(this IConventionIndexBuilder indexBuilder, IReadOnlyList<string>? values, bool fromDataAnnotation)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
values
IReadOnlyList<string>The sort options to use for each column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
A builder to further configure the index.
Remarks
CanSetIncludeProperties(IConventionIndexBuilder, IReadOnlyList<string>?, bool)
Returns a value indicating whether the given include properties can be set.
public static bool CanSetIncludeProperties(this IConventionIndexBuilder indexBuilder, IReadOnlyList<string>? propertyNames, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
propertyNames
IReadOnlyList<string>An array of property names to be used in 'include' clause.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the given include properties can be set.
CanSetIsCreatedConcurrently(IConventionIndexBuilder, bool?, bool)
Returns a value indicating whether concurrent creation for the index can be set.
public static bool CanSetIsCreatedConcurrently(this IConventionIndexBuilder indexBuilder, bool? createdConcurrently, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
createdConcurrently
bool?A value indicating whether the index is created with the "concurrently" option.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
A builder to further configure the index.
Remarks
CanSetIsTsVectorExpressionIndex(IConventionIndexBuilder, string?, bool)
Returns a value indicating whether the index can be configured as a full-text tsvector expression index.
public static bool CanSetIsTsVectorExpressionIndex(this IConventionIndexBuilder indexBuilder, string? config, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
config
stringThe text search configuration for this generated tsvector property, or
null
if this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the index can be configured as a full-text tsvector expression index.
CanSetMethod(IConventionIndexBuilder, string?, bool)
The PostgreSQL index method to be used. Null selects the default (currently btree).
public static bool CanSetMethod(this IConventionIndexBuilder indexBuilder, string? method, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
method
stringThe name of the index.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the index can be configured with the method
Remarks
CanSetNullSortOrder(IConventionIndexBuilder, IReadOnlyList<NullSortOrder>?, bool)
Returns a value indicating whether the PostgreSQL index null sort ordering can be set.
public static bool CanSetNullSortOrder(this IConventionIndexBuilder indexBuilder, IReadOnlyList<NullSortOrder>? values, bool fromDataAnnotation)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
values
IReadOnlyList<NullSortOrder>The sort order to use for each column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
A builder to further configure the index.
Remarks
CanSetOperators(IConventionIndexBuilder, IReadOnlyList<string>?, bool)
Returns a value indicating whether the PostgreSQL index operators can be set.
public static bool CanSetOperators(this IConventionIndexBuilder indexBuilder, IReadOnlyList<string>? operators, bool fromDataAnnotation)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
operators
IReadOnlyList<string>The operators to use for each column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the index can be configured with the method.
Remarks
CanSetStorageParameter(IConventionIndexBuilder, string, object?, bool)
Returns a value indicating whether the PostgreSQL storage parameter is set on the table created for this entity.
public static bool CanSetStorageParameter(this IConventionIndexBuilder indexBuilder, string parameterName, object? parameterValue, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
parameterName
stringThe name of the storage parameter.
parameterValue
objectThe value of the storage parameter.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the index can be configured as with the storage parameter.
Remarks
HasMethod(IConventionIndexBuilder, string?, bool)
The PostgreSQL index method to be used. Null selects the default (currently btree).
public static IConventionIndexBuilder? HasMethod(this IConventionIndexBuilder indexBuilder, string? method, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
method
stringThe name of the index.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
A builder to further configure the index.
Remarks
HasMethod(IndexBuilder, string?)
The PostgreSQL index method to be used. Null selects the default (currently btree).
public static IndexBuilder HasMethod(this IndexBuilder indexBuilder, string? method)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
method
stringThe name of the index.
Returns
- IndexBuilder
A builder to further configure the index.
Remarks
HasMethod<TEntity>(IndexBuilder<TEntity>, string?)
The PostgreSQL index method to be used. Null selects the default (currently btree).
public static IndexBuilder<TEntity> HasMethod<TEntity>(this IndexBuilder<TEntity> indexBuilder, string? method)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
method
stringThe name of the index.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
Remarks
HasNullSortOrder(IConventionIndexBuilder, IReadOnlyList<NullSortOrder>?, bool)
The PostgreSQL index NULL sort ordering to be used.
public static IConventionIndexBuilder? HasNullSortOrder(this IConventionIndexBuilder indexBuilder, IReadOnlyList<NullSortOrder>? values, bool fromDataAnnotation)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
values
IReadOnlyList<NullSortOrder>The sort order to use for each column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
A builder to further configure the index.
Remarks
HasNullSortOrder(IndexBuilder, params NullSortOrder[]?)
The PostgreSQL index NULL sort ordering to be used.
public static IndexBuilder HasNullSortOrder(this IndexBuilder indexBuilder, params NullSortOrder[]? values)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
values
NullSortOrder[]The sort order to use for each column.
Returns
- IndexBuilder
A builder to further configure the index.
Remarks
HasNullSortOrder<TEntity>(IndexBuilder<TEntity>, params NullSortOrder[]?)
The PostgreSQL index NULL sort ordering to be used.
public static IndexBuilder<TEntity> HasNullSortOrder<TEntity>(this IndexBuilder<TEntity> indexBuilder, params NullSortOrder[]? values)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
values
NullSortOrder[]The sort order to use for each column.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
Remarks
HasOperators(IConventionIndexBuilder, IReadOnlyList<string>?, bool)
The PostgreSQL index operators to be used.
public static IConventionIndexBuilder? HasOperators(this IConventionIndexBuilder indexBuilder, IReadOnlyList<string>? operators, bool fromDataAnnotation)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
operators
IReadOnlyList<string>The operators to use for each column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
A builder to further configure the index.
Remarks
HasOperators(IndexBuilder, params string[]?)
The PostgreSQL index operators to be used.
public static IndexBuilder HasOperators(this IndexBuilder indexBuilder, params string[]? operators)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
operators
string[]The operators to use for each column.
Returns
- IndexBuilder
A builder to further configure the index.
Remarks
HasOperators<TEntity>(IndexBuilder<TEntity>, params string[]?)
The PostgreSQL index operators to be used.
public static IndexBuilder<TEntity> HasOperators<TEntity>(this IndexBuilder<TEntity> indexBuilder, params string[]? operators)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
operators
string[]The operators to use for each column.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
Remarks
HasStorageParameter(IConventionIndexBuilder, string, object?, bool)
Sets a PostgreSQL storage parameter on the index.
public static IConventionIndexBuilder? HasStorageParameter(this IConventionIndexBuilder indexBuilder, string parameterName, object? parameterValue, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
parameterName
stringThe name of the storage parameter.
parameterValue
objectThe value of the storage parameter.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
true
if the index can be configured with the method
Remarks
HasStorageParameter(IndexBuilder, string, object?)
Sets a PostgreSQL storage parameter on the index.
public static IndexBuilder HasStorageParameter(this IndexBuilder indexBuilder, string parameterName, object? parameterValue)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
parameterName
stringThe name of the storage parameter.
parameterValue
objectThe value of the storage parameter.
Returns
- IndexBuilder
The same builder instance so that multiple calls can be chained.
Remarks
HasStorageParameter<TEntity>(IndexBuilder<TEntity>, string, object?)
Sets a PostgreSQL storage parameter on the index.
public static IndexBuilder<TEntity> HasStorageParameter<TEntity>(this IndexBuilder<TEntity> indexBuilder, string parameterName, object? parameterValue) where TEntity : class
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
parameterName
stringThe name of the storage parameter.
parameterValue
objectThe value of the storage parameter.
Returns
- IndexBuilder<TEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntity
Remarks
IncludeProperties(IConventionIndexBuilder, IReadOnlyList<string>, bool)
Adds an INCLUDE clause to the index definition with the specified property names. This clause specifies a list of columns which will be included as a non-key part in the index.
public static IConventionIndexBuilder? IncludeProperties(this IConventionIndexBuilder indexBuilder, IReadOnlyList<string> propertyNames, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
propertyNames
IReadOnlyList<string>An array of property names to be used in INCLUDE clause.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
A builder to further configure the index.
Remarks
IncludeProperties(IndexBuilder, params string[])
Adds an INCLUDE clause to the index definition with the specified property names. This clause specifies a list of columns which will be included as a non-key part in the index.
public static IndexBuilder IncludeProperties(this IndexBuilder indexBuilder, params string[] propertyNames)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
propertyNames
string[]An array of property names to be used in INCLUDE clause.
Returns
- IndexBuilder
A builder to further configure the index.
Remarks
IncludeProperties<TEntity>(IndexBuilder<TEntity>, Expression<Func<TEntity, object>>)
Adds an INCLUDE clause to the index definition with property names from the specified expression. This clause specifies a list of columns which will be included as a non-key part in the index.
public static IndexBuilder<TEntity> IncludeProperties<TEntity>(this IndexBuilder<TEntity> indexBuilder, Expression<Func<TEntity, object>> includeExpression)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
includeExpression
Expression<Func<TEntity, object>>A lambda expression representing the property(s) to be included in the INCLUDE clause (
blog => blog.Url
).If multiple properties are to be included then specify an anonymous type including the properties (
post => new { post.Title, post.BlogId }
).
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
Remarks
IncludeProperties<TEntity>(IndexBuilder<TEntity>, params string[])
Adds an INCLUDE clause to the index definition with the specified property names. This clause specifies a list of columns which will be included as a non-key part in the index.
public static IndexBuilder<TEntity> IncludeProperties<TEntity>(this IndexBuilder<TEntity> indexBuilder, params string[] propertyNames)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
propertyNames
string[]An array of property names to be used in INCLUDE clause.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
Remarks
IsCreatedConcurrently(IConventionIndexBuilder, bool?, bool)
When this option is used, PostgreSQL will build the index without taking any locks that prevent concurrent inserts, updates, or deletes on the table; whereas a standard index build locks out writes (but not reads) on the table until it's done.
public static IConventionIndexBuilder? IsCreatedConcurrently(this IConventionIndexBuilder indexBuilder, bool? createdConcurrently, bool fromDataAnnotation = false)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
createdConcurrently
bool?A value indicating whether the index is created with the "concurrently" option.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
A builder to further configure the index.
Remarks
IsCreatedConcurrently(IndexBuilder, bool)
When this option is used, PostgreSQL will build the index without taking any locks that prevent concurrent inserts, updates, or deletes on the table; whereas a standard index build locks out writes (but not reads) on the table until it's done.
public static IndexBuilder IsCreatedConcurrently(this IndexBuilder indexBuilder, bool createdConcurrently = true)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
createdConcurrently
boolA value indicating whether the index is created with the "concurrently" option.
Returns
- IndexBuilder
A builder to further configure the index.
Remarks
IsCreatedConcurrently<TEntity>(IndexBuilder<TEntity>, bool)
When this option is used, PostgreSQL will build the index without taking any locks that prevent concurrent inserts, updates, or deletes on the table; whereas a standard index build locks out writes (but not reads) on the table until it's done.
public static IndexBuilder<TEntity> IsCreatedConcurrently<TEntity>(this IndexBuilder<TEntity> indexBuilder, bool createdConcurrently = true)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
createdConcurrently
boolA value indicating whether the index is created with the "concurrently" option.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
Remarks
IsTsVectorExpressionIndex(IConventionIndexBuilder, string?)
Configures this index to be a full-text tsvector expression index.
public static IConventionIndexBuilder? IsTsVectorExpressionIndex(this IConventionIndexBuilder indexBuilder, string? config)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
config
stringThe text search configuration for this generated tsvector property, or
null
if this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
Returns
- IConventionIndexBuilder
The same builder instance if the configuration was applied,
null
otherwise.
IsTsVectorExpressionIndex(IndexBuilder, string)
Configures this index to be a full-text tsvector expression index.
public static IndexBuilder IsTsVectorExpressionIndex(this IndexBuilder indexBuilder, string config)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
config
stringThe text search configuration for this generated tsvector property, or
null
if this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
Returns
- IndexBuilder
A builder to further configure the index.
IsTsVectorExpressionIndex<TEntity>(IndexBuilder<TEntity>, string)
Configures this index to be a full-text tsvector expression index.
public static IndexBuilder<TEntity> IsTsVectorExpressionIndex<TEntity>(this IndexBuilder<TEntity> indexBuilder, string config)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
config
stringThe text search configuration for this generated tsvector property, or
null
if this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity
UseCollation(IConventionIndexBuilder, IReadOnlyList<string>?, bool)
The PostgreSQL index collation to be used.
public static IConventionIndexBuilder? UseCollation(this IConventionIndexBuilder indexBuilder, IReadOnlyList<string>? values, bool fromDataAnnotation)
Parameters
indexBuilder
IConventionIndexBuilderThe builder for the index being configured.
values
IReadOnlyList<string>The sort options to use for each column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionIndexBuilder
A builder to further configure the index.
Remarks
UseCollation(IndexBuilder, params string[]?)
The PostgreSQL index collation to be used.
public static IndexBuilder UseCollation(this IndexBuilder indexBuilder, params string[]? values)
Parameters
indexBuilder
IndexBuilderThe builder for the index being configured.
values
string[]The sort options to use for each column.
Returns
- IndexBuilder
A builder to further configure the index.
Remarks
UseCollation<TEntity>(IndexBuilder<TEntity>, params string[]?)
The PostgreSQL index collation to be used.
public static IndexBuilder<TEntity> UseCollation<TEntity>(this IndexBuilder<TEntity> indexBuilder, params string[]? values)
Parameters
indexBuilder
IndexBuilder<TEntity>The builder for the index being configured.
values
string[]The sort options to use for each column.
Returns
- IndexBuilder<TEntity>
A builder to further configure the index.
Type Parameters
TEntity