Class NpgsqlEntityTypeBuilderExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Npgsql.EntityFrameworkCore.PostgreSQL.dll
Npgsql-specific extension methods for EntityTypeBuilder.
public static class NpgsqlEntityTypeBuilderExtensions
- Inheritance
-
NpgsqlEntityTypeBuilderExtensions
- Inherited Members
Remarks
Methods
CanSetIsUnlogged(IConventionEntityTypeBuilder, bool, bool)
Returns a value indicating whether the mapped table can be configured to use an unlogged table when targeting Npgsql.
public static bool CanSetIsUnlogged(this IConventionEntityTypeBuilder entityTypeBuilder, bool unlogged = true, bool fromDataAnnotation = false)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type being configured.
unlogged
boolTrue to configure the entity to use an unlogged table; otherwise, false.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
The same builder instance so that multiple calls can be chained.
Remarks
CanSetStorageParameter(IConventionEntityTypeBuilder, 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 IConventionEntityTypeBuilder entityTypeBuilder, string parameterName, object? parameterValue, bool fromDataAnnotation = false)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type 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 mapped table can be configured as with the storage parameter.
Remarks
HasGeneratedTsVectorColumn<TEntity>(EntityTypeBuilder<TEntity>, Expression<Func<TEntity, NpgsqlTsVector>>, string, Expression<Func<TEntity, object>>)
Configures a property on this entity to be a full-text search tsvector column over other given properties.
public static EntityTypeBuilder<TEntity> HasGeneratedTsVectorColumn<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, Expression<Func<TEntity, NpgsqlTsVector>> tsVectorPropertyExpression, string config, Expression<Func<TEntity, object>> includeExpression) where TEntity : class
Parameters
entityTypeBuilder
EntityTypeBuilder<TEntity>The builder for the entity being configured.
tsVectorPropertyExpression
Expression<Func<TEntity, NpgsqlTsVector>>A lambda expression representing the property to be configured as a tsvector column (
blog => blog.Url
).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.
includeExpression
Expression<Func<TEntity, object>>A lambda expression representing the property(s) to be included in the tsvector column (
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
- EntityTypeBuilder<TEntity>
A builder to further configure the property.
Type Parameters
TEntity
HasStorageParameter(EntityTypeBuilder, string, object?)
Sets a PostgreSQL storage parameter on the table created for this entity.
public static EntityTypeBuilder HasStorageParameter(this EntityTypeBuilder entityTypeBuilder, string parameterName, object? parameterValue)
Parameters
entityTypeBuilder
EntityTypeBuilderThe builder for the entity type being configured.
parameterName
stringThe name of the storage parameter.
parameterValue
objectThe value of the storage parameter.
Returns
- EntityTypeBuilder
The same builder instance so that multiple calls can be chained.
Remarks
HasStorageParameter(IConventionEntityTypeBuilder, string, object?, bool)
Sets a PostgreSQL storage parameter on the table created for this entity.
public static IConventionEntityTypeBuilder? HasStorageParameter(this IConventionEntityTypeBuilder entityTypeBuilder, string parameterName, object? parameterValue, bool fromDataAnnotation = false)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type 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
- IConventionEntityTypeBuilder
The same builder instance so that multiple calls can be chained.
Remarks
HasStorageParameter<TEntity>(EntityTypeBuilder<TEntity>, string, object?)
Sets a PostgreSQL storage parameter on the table created for this entity.
public static EntityTypeBuilder<TEntity> HasStorageParameter<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, string parameterName, object? parameterValue) where TEntity : class
Parameters
entityTypeBuilder
EntityTypeBuilder<TEntity>The builder for the entity type being configured.
parameterName
stringThe name of the storage parameter.
parameterValue
objectThe value of the storage parameter.
Returns
- EntityTypeBuilder<TEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntity
Remarks
IsUnlogged(EntityTypeBuilder, bool)
Configures the entity to use an unlogged table when targeting Npgsql.
public static EntityTypeBuilder IsUnlogged(this EntityTypeBuilder entityTypeBuilder, bool unlogged = true)
Parameters
entityTypeBuilder
EntityTypeBuilderThe builder for the entity type being configured.
unlogged
boolTrue to configure the entity to use an unlogged table; otherwise, false.
Returns
- EntityTypeBuilder
The same builder instance so that multiple calls can be chained.
Remarks
IsUnlogged(IConventionEntityTypeBuilder, bool, bool)
Configures the mapped table to use an unlogged table when targeting Npgsql.
public static IConventionEntityTypeBuilder? IsUnlogged(this IConventionEntityTypeBuilder entityTypeBuilder, bool unlogged = true, bool fromDataAnnotation = false)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type being configured.
unlogged
boolTrue to configure the entity to use an unlogged table; otherwise, false.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionEntityTypeBuilder
The same builder instance so that multiple calls can be chained.
Remarks
IsUnlogged<TEntity>(EntityTypeBuilder<TEntity>, bool)
Configures the mapped table to use an unlogged table when targeting Npgsql.
public static EntityTypeBuilder<TEntity> IsUnlogged<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, bool unlogged = true) where TEntity : class
Parameters
entityTypeBuilder
EntityTypeBuilder<TEntity>The builder for the entity type being configured.
unlogged
boolTrue to configure the entity to use an unlogged table; otherwise, false.
Returns
- EntityTypeBuilder<TEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntity
Remarks
UseCockroachDbInterleaveInParent(EntityTypeBuilder, Type, List<string>)
Specifies that the CockroachDB-specific "interleave in parent" feature should be used.
public static EntityTypeBuilder UseCockroachDbInterleaveInParent(this EntityTypeBuilder entityTypeBuilder, Type parentTableType, List<string> interleavePrefix)
Parameters
entityTypeBuilder
EntityTypeBuilderparentTableType
TypeinterleavePrefix
List<string>
Returns
UseCockroachDbInterleaveInParent<TEntity>(EntityTypeBuilder<TEntity>, Type, List<string>)
Specifies that the CockroachDB-specific "interleave in parent" feature should be used.
public static EntityTypeBuilder<TEntity> UseCockroachDbInterleaveInParent<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, Type parentTableType, List<string> interleavePrefix) where TEntity : class
Parameters
entityTypeBuilder
EntityTypeBuilder<TEntity>parentTableType
TypeinterleavePrefix
List<string>
Returns
- EntityTypeBuilder<TEntity>
Type Parameters
TEntity