Class NpgsqlEntityTypeBuilderExtensions
Npgsql-specific extension methods for
Namespace: Microsoft.EntityFrameworkCore
Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
Syntax
public static class NpgsqlEntityTypeBuilderExtensions
Remarks
Methods
| Improve this Doc View SourceCanSetIsUnlogged(IConventionEntityTypeBuilder, bool, bool)
Returns a value indicating whether the mapped table can be configured to use an unlogged table when targeting Npgsql.
Declaration
public static bool CanSetIsUnlogged(this IConventionEntityTypeBuilder entityTypeBuilder, bool unlogged = true, bool fromDataAnnotation = false)
Parameters
Type | Name | Description |
---|---|---|
IConventionEntityTypeBuilder | entityTypeBuilder | The builder for the entity type being configured. |
bool | unlogged | True to configure the entity to use an unlogged table; otherwise, false. |
bool | fromDataAnnotation | Indicates whether the configuration was specified using a data annotation. |
Returns
Type | Description |
---|---|
bool | The same builder instance so that multiple calls can be chained. |
Remarks
| Improve this Doc View SourceCanSetStorageParameter(IConventionEntityTypeBuilder, string, object?, bool)
Returns a value indicating whether the PostgreSQL storage parameter on the table created for this entity.
Declaration
public static bool CanSetStorageParameter(this IConventionEntityTypeBuilder entityTypeBuilder, string parameterName, object? parameterValue, bool fromDataAnnotation = false)
Parameters
Type | Name | Description |
---|---|---|
IConventionEntityTypeBuilder | entityTypeBuilder | The builder for the entity type being configured. |
string | parameterName | The name of the storage parameter. |
object? | parameterValue | The value of the storage parameter. |
bool | fromDataAnnotation | Indicates whether the configuration was specified using a data annotation. |
Returns
Type | Description |
---|---|
bool |
|
Remarks
| Improve this Doc View SourceHasGeneratedTsVectorColumn<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.
Declaration
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
Type | Name | Description |
---|---|---|
EntityTypeBuilder<><TEntity> | entityTypeBuilder | The builder for the entity being configured. |
Expression<><Func<, ><TEntity, NpgsqlTsVector>> | tsVectorPropertyExpression | A lambda expression representing the property to be configured as a tsvector column
( |
string | config |
The text search configuration for this generated tsvector property, or See https://www.postgresql.org/docs/current/textsearch-controls.html for more information. |
Expression<><Func<, ><TEntity, object>> | includeExpression |
A lambda expression representing the property(s) to be included in the tsvector column
(
If multiple properties are to be included then specify an anonymous type including the
properties ( |
Returns
Type | Description |
---|---|
EntityTypeBuilder<><TEntity> | A builder to further configure the property. |
Type Parameters
Name | Description |
---|---|
TEntity |
Remarks
| Improve this Doc View SourceHasStorageParameter(EntityTypeBuilder, string, object?)
Sets a PostgreSQL storage parameter on the table created for this entity.
Declaration
public static EntityTypeBuilder HasStorageParameter(this EntityTypeBuilder entityTypeBuilder, string parameterName, object? parameterValue)
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder | entityTypeBuilder | The builder for the entity type being configured. |
string | parameterName | The name of the storage parameter. |
object? | parameterValue | The value of the storage parameter. |
Returns
Type | Description |
---|---|
EntityTypeBuilder | The same builder instance so that multiple calls can be chained. |
Remarks
| Improve this Doc View SourceHasStorageParameter(IConventionEntityTypeBuilder, string, object?, bool)
Sets a PostgreSQL storage parameter on the table created for this entity.
Declaration
public static IConventionEntityTypeBuilder? HasStorageParameter(this IConventionEntityTypeBuilder entityTypeBuilder, string parameterName, object? parameterValue, bool fromDataAnnotation = false)
Parameters
Type | Name | Description |
---|---|---|
IConventionEntityTypeBuilder | entityTypeBuilder | The builder for the entity type being configured. |
string | parameterName | The name of the storage parameter. |
object? | parameterValue | The value of the storage parameter. |
bool | fromDataAnnotation | Indicates whether the configuration was specified using a data annotation. |
Returns
Type | Description |
---|---|
IConventionEntityTypeBuilder? | The same builder instance so that multiple calls can be chained. |
Remarks
| Improve this Doc View SourceHasStorageParameter<TEntity>(EntityTypeBuilder<TEntity>, string, object?)
Sets a PostgreSQL storage parameter on the table created for this entity.
Declaration
public static EntityTypeBuilder<TEntity> HasStorageParameter<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, string parameterName, object? parameterValue) where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder<><TEntity> | entityTypeBuilder | The builder for the entity type being configured. |
string | parameterName | The name of the storage parameter. |
object? | parameterValue | The value of the storage parameter. |
Returns
Type | Description |
---|---|
EntityTypeBuilder<><TEntity> | The same builder instance so that multiple calls can be chained. |
Type Parameters
Name | Description |
---|---|
TEntity |
Remarks
| Improve this Doc View SourceIsUnlogged(EntityTypeBuilder, bool)
Configures the entity to use an unlogged table when targeting Npgsql.
Declaration
public static EntityTypeBuilder IsUnlogged(this EntityTypeBuilder entityTypeBuilder, bool unlogged = true)
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder | entityTypeBuilder | The builder for the entity type being configured. |
bool | unlogged | True to configure the entity to use an unlogged table; otherwise, false. |
Returns
Type | Description |
---|---|
EntityTypeBuilder | The same builder instance so that multiple calls can be chained. |
Remarks
| Improve this Doc View SourceIsUnlogged(IConventionEntityTypeBuilder, bool, bool)
Configures the mapped table to use an unlogged table when targeting Npgsql.
Declaration
public static IConventionEntityTypeBuilder? IsUnlogged(this IConventionEntityTypeBuilder entityTypeBuilder, bool unlogged = true, bool fromDataAnnotation = false)
Parameters
Type | Name | Description |
---|---|---|
IConventionEntityTypeBuilder | entityTypeBuilder | The builder for the entity type being configured. |
bool | unlogged | True to configure the entity to use an unlogged table; otherwise, false. |
bool | fromDataAnnotation | Indicates whether the configuration was specified using a data annotation. |
Returns
Type | Description |
---|---|
IConventionEntityTypeBuilder? | The same builder instance so that multiple calls can be chained. |
Remarks
| Improve this Doc View SourceIsUnlogged<TEntity>(EntityTypeBuilder<TEntity>, bool)
Configures the mapped table to use an unlogged table when targeting Npgsql.
Declaration
public static EntityTypeBuilder<TEntity> IsUnlogged<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, bool unlogged = true) where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder<><TEntity> | entityTypeBuilder | The builder for the entity type being configured. |
bool | unlogged | True to configure the entity to use an unlogged table; otherwise, false. |
Returns
Type | Description |
---|---|
EntityTypeBuilder<><TEntity> | The same builder instance so that multiple calls can be chained. |
Type Parameters
Name | Description |
---|---|
TEntity |
Remarks
| Improve this Doc View SourceUseCockroachDbInterleaveInParent(EntityTypeBuilder, Type, List<string>)
Specifies that the CockroachDB-specific "interleave in parent" feature should be used.
Declaration
public static EntityTypeBuilder UseCockroachDbInterleaveInParent(this EntityTypeBuilder entityTypeBuilder, Type parentTableType, List<string> interleavePrefix)
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder | entityTypeBuilder | |
Type | parentTableType | |
List<><string> | interleavePrefix |
Returns
Type | Description |
---|---|
EntityTypeBuilder |
Remarks
| Improve this Doc View SourceUseCockroachDbInterleaveInParent<TEntity>(EntityTypeBuilder<TEntity>, Type, List<string>)
Specifies that the CockroachDB-specific "interleave in parent" feature should be used.
Declaration
public static EntityTypeBuilder<TEntity> UseCockroachDbInterleaveInParent<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, Type parentTableType, List<string> interleavePrefix) where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder<><TEntity> | entityTypeBuilder | |
Type | parentTableType | |
List<><string> | interleavePrefix |
Returns
Type | Description |
---|---|
EntityTypeBuilder<><TEntity> |
Type Parameters
Name | Description |
---|---|
TEntity |
Remarks
| Improve this Doc View SourceUseXminAsConcurrencyToken(EntityTypeBuilder)
Configures using the auto-updating system column xmin
as the optimistic concurrency token.
Declaration
public static EntityTypeBuilder UseXminAsConcurrencyToken(this EntityTypeBuilder entityTypeBuilder)
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder | entityTypeBuilder | The builder for the entity type being configured. |
Returns
Type | Description |
---|---|
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.
Declaration
public static EntityTypeBuilder<TEntity> UseXminAsConcurrencyToken<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder) where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
EntityTypeBuilder<><TEntity> | entityTypeBuilder | The builder for the entity type being configured. |
Returns
Type | Description |
---|---|
EntityTypeBuilder<><TEntity> | The same builder instance so that multiple calls can be chained. |
Type Parameters
Name | Description |
---|---|
TEntity |