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
entityTypeBuilderIConventionEntityTypeBuilderThe builder for the entity type being configured.
unloggedboolTrue to configure the entity to use an unlogged table; otherwise, false.
fromDataAnnotationboolIndicates 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
entityTypeBuilderIConventionEntityTypeBuilderThe builder for the entity type being configured.
parameterNamestringThe name of the storage parameter.
parameterValueobjectThe value of the storage parameter.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
trueif 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
entityTypeBuilderEntityTypeBuilder<TEntity>The builder for the entity being configured.
tsVectorPropertyExpressionExpression<Func<TEntity, NpgsqlTsVector>>A lambda expression representing the property to be configured as a tsvector column (
blog => blog.Url).configstringThe text search configuration for this generated tsvector property, or
nullif this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
includeExpressionExpression<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
entityTypeBuilderEntityTypeBuilderThe builder for the entity type being configured.
parameterNamestringThe name of the storage parameter.
parameterValueobjectThe 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
entityTypeBuilderIConventionEntityTypeBuilderThe builder for the entity type being configured.
parameterNamestringThe name of the storage parameter.
parameterValueobjectThe value of the storage parameter.
fromDataAnnotationboolIndicates 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
entityTypeBuilderEntityTypeBuilder<TEntity>The builder for the entity type being configured.
parameterNamestringThe name of the storage parameter.
parameterValueobjectThe 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
entityTypeBuilderEntityTypeBuilderThe builder for the entity type being configured.
unloggedboolTrue 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
entityTypeBuilderIConventionEntityTypeBuilderThe builder for the entity type being configured.
unloggedboolTrue to configure the entity to use an unlogged table; otherwise, false.
fromDataAnnotationboolIndicates 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
entityTypeBuilderEntityTypeBuilder<TEntity>The builder for the entity type being configured.
unloggedboolTrue 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
entityTypeBuilderEntityTypeBuilderparentTableTypeTypeinterleavePrefixList<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
entityTypeBuilderEntityTypeBuilder<TEntity>parentTableTypeTypeinterleavePrefixList<string>
Returns
- EntityTypeBuilder<TEntity>
Type Parameters
TEntity
UseXminAsConcurrencyToken(EntityTypeBuilder)
Configures using the auto-updating system column xmin as the optimistic concurrency token.
[Obsolete("Use EF Core's standard IsRowVersion() or [Timestamp], see https://learn.microsoft.com/ef/core/saving/concurrency")]
public static EntityTypeBuilder UseXminAsConcurrencyToken(this EntityTypeBuilder entityTypeBuilder)
Parameters
entityTypeBuilderEntityTypeBuilderThe builder for the entity type being configured.
Returns
- EntityTypeBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Concurrency tokens for more information on using optimistic concurrency in PostgreSQL.
UseXminAsConcurrencyToken<TEntity>(EntityTypeBuilder<TEntity>)
Configures using the auto-updating system column xmin as the optimistic concurrency token.
[Obsolete("Use EF Core's standard IsRowVersion() or [Timestamp], see https://learn.microsoft.com/ef/core/saving/concurrency")]
public static EntityTypeBuilder<TEntity> UseXminAsConcurrencyToken<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder) where TEntity : class
Parameters
entityTypeBuilderEntityTypeBuilder<TEntity>The builder for the entity type being configured.
Returns
- EntityTypeBuilder<TEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntity