Search Results for

    Show / Hide Table of Contents

    Class NpgsqlEntityTypeBuilderExtensions

    Npgsql-specific extension methods for .

    Inheritance
    object
    NpgsqlEntityTypeBuilderExtensions
    Namespace: Microsoft.EntityFrameworkCore
    Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
    Syntax
    public static class NpgsqlEntityTypeBuilderExtensions
    Remarks

    See Modeling entity types and relationships.

    Methods

    | Improve this Doc View Source

    CanSetIsUnlogged(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

    See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED

    | Improve this Doc View Source

    CanSetStorageParameter(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

    true if the mapped table can be configured as with the storage parameter.

    Remarks

    See https://www.postgresql.org/docs/current/static/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS

    | Improve this Doc View Source

    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.

    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 (blog => blog.Url).

    string config

    The 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.

    Expression<><Func<, ><TEntity, object>> includeExpression

    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
    Type Description
    EntityTypeBuilder<><TEntity>

    A builder to further configure the property.

    Type Parameters
    Name Description
    TEntity
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    HasStorageParameter(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

    See https://www.postgresql.org/docs/current/static/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS

    | Improve this Doc View Source

    HasStorageParameter(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

    See https://www.postgresql.org/docs/current/static/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS

    | Improve this Doc View Source

    HasStorageParameter<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

    See https://www.postgresql.org/docs/current/static/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS

    | Improve this Doc View Source

    IsUnlogged(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

    See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED

    | Improve this Doc View Source

    IsUnlogged(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

    See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED

    | Improve this Doc View Source

    IsUnlogged<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

    See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED

    | Improve this Doc View Source

    UseCockroachDbInterleaveInParent(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

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    UseCockroachDbInterleaveInParent<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

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    UseXminAsConcurrencyToken(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.

    | Improve this Doc View Source

    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
    Remarks

    See http://www.npgsql.org/efcore/miscellaneous.html#optimistic-concurrency-and-concurrency-tokens

    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team