Search Results for

    Show / Hide Table of Contents

    Class NpgsqlModelExtensions

    Model extension methods for Npgsql-specific metadata.

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

    See Modeling entity types and relationships.

    Fields

    | Improve this Doc View Source

    DefaultHiLoSequenceName

    The default name for the hi-lo sequence.

    Declaration
    public const string DefaultHiLoSequenceName
    Field Value
    Type Description
    string
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    DefaultSequenceNameSuffix

    The default prefix for sequences applied to properties.

    Declaration
    public const string DefaultSequenceNameSuffix
    Field Value
    Type Description
    string
    Remarks

    See Modeling entity types and relationships.

    Methods

    | Improve this Doc View Source

    GetCollations(IReadOnlyModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static IReadOnlyList<PostgresCollation> GetCollations(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model
    Returns
    Type Description
    IReadOnlyList<><PostgresCollation>
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetDatabaseTemplate(IReadOnlyModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static string? GetDatabaseTemplate(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model
    Returns
    Type Description
    string?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetDatabaseTemplateConfigurationSource(IConventionModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static ConfigurationSource? GetDatabaseTemplateConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model
    Returns
    Type Description
    ConfigurationSource?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetDefaultColumnCollation(IReadOnlyModel)

    Gets the default collation for all columns in the database, or null if none is defined. This causes EF Core to specify an explicit collation when creating all column, unless one is overridden on a column.

    Declaration
    public static string? GetDefaultColumnCollation(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model
    Returns
    Type Description
    string?
    Remarks

    See for another approach to defining a database-wide collation.

    For more information, see https://www.postgresql.org/docs/current/collation.html.

    | Improve this Doc View Source

    GetDefaultColumnCollationConfigurationSource(IConventionModel)

    Returns the for the default column collation.

    Declaration
    public static ConfigurationSource? GetDefaultColumnCollationConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    Returns
    Type Description
    ConfigurationSource?

    The for the default column collation.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetHiLoSequenceName(IReadOnlyModel)

    Returns the name to use for the default hi-lo sequence.

    Declaration
    public static string GetHiLoSequenceName(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model

    The model.

    Returns
    Type Description
    string

    The name to use for the default hi-lo sequence.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetHiLoSequenceNameConfigurationSource(IConventionModel)

    Returns the for the default hi-lo sequence name.

    Declaration
    public static ConfigurationSource? GetHiLoSequenceNameConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    Returns
    Type Description
    ConfigurationSource?

    The for the default hi-lo sequence name.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetHiLoSequenceSchema(IReadOnlyModel)

    Returns the schema to use for the default hi-lo sequence. UseHiLo(PropertyBuilder, string?, string?)

    Declaration
    public static string? GetHiLoSequenceSchema(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model

    The model.

    Returns
    Type Description
    string?

    The schema to use for the default hi-lo sequence.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetHiLoSequenceSchemaConfigurationSource(IConventionModel)

    Returns the for the default hi-lo sequence schema.

    Declaration
    public static ConfigurationSource? GetHiLoSequenceSchemaConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    Returns
    Type Description
    ConfigurationSource?

    The for the default hi-lo sequence schema.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetOrAddCollation(IMutableModel, string?, string, string, string, string?, bool?)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static PostgresCollation GetOrAddCollation(this IMutableModel model, string? schema, string name, string lcCollate, string lcCtype, string? provider = null, bool? deterministic = null)
    Parameters
    Type Name Description
    IMutableModel model
    string? schema
    string name
    string lcCollate
    string lcCtype
    string? provider
    bool? deterministic
    Returns
    Type Description
    PostgresCollation
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetOrAddPostgresEnum(IMutableModel, string?, string, string[])

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static PostgresEnum GetOrAddPostgresEnum(this IMutableModel model, string? schema, string name, string[] labels)
    Parameters
    Type Name Description
    IMutableModel model
    string? schema
    string name
    string[] labels
    Returns
    Type Description
    PostgresEnum
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetOrAddPostgresExtension(IConventionModel, string?, string, string?)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static PostgresExtension GetOrAddPostgresExtension(this IConventionModel model, string? schema, string name, string? version)
    Parameters
    Type Name Description
    IConventionModel model
    string? schema
    string name
    string? version
    Returns
    Type Description
    PostgresExtension
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetOrAddPostgresExtension(IMutableModel, string?, string, string?)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static PostgresExtension GetOrAddPostgresExtension(this IMutableModel model, string? schema, string name, string? version)
    Parameters
    Type Name Description
    IMutableModel model
    string? schema
    string name
    string? version
    Returns
    Type Description
    PostgresExtension
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetOrAddPostgresRange(IMutableModel, string?, string, string, string?, string?, string?, string?)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static PostgresRange GetOrAddPostgresRange(this IMutableModel model, string? schema, string name, string subtype, string? canonicalFunction = null, string? subtypeOpClass = null, string? collation = null, string? subtypeDiff = null)
    Parameters
    Type Name Description
    IMutableModel model
    string? schema
    string name
    string subtype
    string? canonicalFunction
    string? subtypeOpClass
    string? collation
    string? subtypeDiff
    Returns
    Type Description
    PostgresRange
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetPostgresEnums(IReadOnlyModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static IReadOnlyList<PostgresEnum> GetPostgresEnums(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model
    Returns
    Type Description
    IReadOnlyList<><PostgresEnum>
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetPostgresExtensions(IReadOnlyModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static IReadOnlyList<PostgresExtension> GetPostgresExtensions(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model
    Returns
    Type Description
    IReadOnlyList<><PostgresExtension>
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetSequenceNameSuffix(IReadOnlyModel)

    Returns the suffix to append to the name of automatically created sequences.

    Declaration
    public static string GetSequenceNameSuffix(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model

    The model.

    Returns
    Type Description
    string

    The name to use for the default key value generation sequence.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetSequenceNameSuffixConfigurationSource(IConventionModel)

    Returns the for the default value generation sequence name suffix.

    Declaration
    public static ConfigurationSource? GetSequenceNameSuffixConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    Returns
    Type Description
    ConfigurationSource?

    The for the default key value generation sequence name.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetSequenceSchema(IReadOnlyModel)

    Returns the schema to use for the default value generation sequence. UseSequence(PropertyBuilder, string?, string?)

    Declaration
    public static string? GetSequenceSchema(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model

    The model.

    Returns
    Type Description
    string?

    The schema to use for the default key value generation sequence.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetSequenceSchemaConfigurationSource(IConventionModel)

    Returns the for the default key value generation sequence schema.

    Declaration
    public static ConfigurationSource? GetSequenceSchemaConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    Returns
    Type Description
    ConfigurationSource?

    The for the default key value generation sequence schema.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetTablespace(IReadOnlyModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static string? GetTablespace(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model
    Returns
    Type Description
    string?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetTablespaceConfigurationSource(IConventionModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static ConfigurationSource? GetTablespaceConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model
    Returns
    Type Description
    ConfigurationSource?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetValueGenerationStrategy(IReadOnlyModel)

    Returns the NpgsqlValueGenerationStrategy to use for properties of keys in the model, unless the property has a strategy explicitly set.

    Declaration
    public static NpgsqlValueGenerationStrategy? GetValueGenerationStrategy(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model

    The model.

    Returns
    Type Description
    NpgsqlValueGenerationStrategy?

    The default NpgsqlValueGenerationStrategy.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    GetValueGenerationStrategyConfigurationSource(IConventionModel)

    Returns the for the default NpgsqlValueGenerationStrategy.

    Declaration
    public static ConfigurationSource? GetValueGenerationStrategyConfigurationSource(this IConventionModel model)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    Returns
    Type Description
    ConfigurationSource?

    The for the default NpgsqlValueGenerationStrategy.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    PostgresRanges(IReadOnlyModel)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static IReadOnlyList<PostgresRange> PostgresRanges(this IReadOnlyModel model)
    Parameters
    Type Name Description
    IReadOnlyModel model
    Returns
    Type Description
    IReadOnlyList<><PostgresRange>
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetDatabaseTemplate(IConventionModel, string?, bool)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static string? SetDatabaseTemplate(this IConventionModel model, string? template, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model
    string? template
    bool fromDataAnnotation
    Returns
    Type Description
    string?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetDatabaseTemplate(IMutableModel, string?)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static void SetDatabaseTemplate(this IMutableModel model, string? template)
    Parameters
    Type Name Description
    IMutableModel model
    string? template
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetDefaultColumnCollation(IConventionModel, string?, bool)

    Sets the default collation for all columns in the database, or null if none is defined. This causes EF Core to specify an explicit collation when creating all column, unless one is overridden on a column.

    Declaration
    public static string? SetDefaultColumnCollation(this IConventionModel model, string? collation, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model
    string? collation
    bool fromDataAnnotation
    Returns
    Type Description
    string?
    Remarks

    See for another approach to defining a database-wide collation.

    For more information, see https://www.postgresql.org/docs/current/collation.html.

    | Improve this Doc View Source

    SetDefaultColumnCollation(IMutableModel, string?)

    Sets the default collation for all columns in the database, or null if none is defined. This causes EF Core to specify an explicit collation when creating all column, unless one is overridden on a column.

    Declaration
    public static void SetDefaultColumnCollation(this IMutableModel model, string? collation)
    Parameters
    Type Name Description
    IMutableModel model
    string? collation
    Remarks

    See for another approach to defining a database-wide collation.

    For more information, see https://www.postgresql.org/docs/current/collation.html.

    | Improve this Doc View Source

    SetHiLoSequenceName(IConventionModel, string?, bool)

    Sets the name to use for the default hi-lo sequence.

    Declaration
    public static string? SetHiLoSequenceName(this IConventionModel model, string? name, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    string? name

    The value to set.

    bool fromDataAnnotation

    Indicates whether the configuration was specified using a data annotation.

    Returns
    Type Description
    string?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetHiLoSequenceName(IMutableModel, string?)

    Sets the name to use for the default hi-lo sequence.

    Declaration
    public static void SetHiLoSequenceName(this IMutableModel model, string? name)
    Parameters
    Type Name Description
    IMutableModel model

    The model.

    string? name

    The value to set.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetHiLoSequenceSchema(IConventionModel, string?, bool)

    Sets the schema to use for the default hi-lo sequence.

    Declaration
    public static string? SetHiLoSequenceSchema(this IConventionModel model, string? value, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    string? value

    The value to set.

    bool fromDataAnnotation

    Indicates whether the configuration was specified using a data annotation.

    Returns
    Type Description
    string?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetHiLoSequenceSchema(IMutableModel, string?)

    Sets the schema to use for the default hi-lo sequence.

    Declaration
    public static void SetHiLoSequenceSchema(this IMutableModel model, string? value)
    Parameters
    Type Name Description
    IMutableModel model

    The model.

    string? value

    The value to set.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetSequenceNameSuffix(IConventionModel, string?, bool)

    Sets the suffix to append to the name of automatically created sequences.

    Declaration
    public static string? SetSequenceNameSuffix(this IConventionModel model, string? name, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    string? name

    The value to set.

    bool fromDataAnnotation

    Indicates whether the configuration was specified using a data annotation.

    Returns
    Type Description
    string?

    The configured value.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetSequenceNameSuffix(IMutableModel, string?)

    Sets the suffix to append to the name of automatically created sequences.

    Declaration
    public static void SetSequenceNameSuffix(this IMutableModel model, string? name)
    Parameters
    Type Name Description
    IMutableModel model

    The model.

    string? name

    The value to set.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetSequenceSchema(IConventionModel, string?, bool)

    Sets the schema to use for the default key value generation sequence.

    Declaration
    public static string? SetSequenceSchema(this IConventionModel model, string? value, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    string? value

    The value to set.

    bool fromDataAnnotation

    Indicates whether the configuration was specified using a data annotation.

    Returns
    Type Description
    string?

    The configured value.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetSequenceSchema(IMutableModel, string?)

    Sets the schema to use for the default key value generation sequence.

    Declaration
    public static void SetSequenceSchema(this IMutableModel model, string? value)
    Parameters
    Type Name Description
    IMutableModel model

    The model.

    string? value

    The value to set.

    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetTablespace(IConventionModel, string?, bool)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static string? SetTablespace(this IConventionModel model, string? tablespace, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model
    string? tablespace
    bool fromDataAnnotation
    Returns
    Type Description
    string?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetTablespace(IMutableModel, string?)

    This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    Declaration
    public static void SetTablespace(this IMutableModel model, string? tablespace)
    Parameters
    Type Name Description
    IMutableModel model
    string? tablespace
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetValueGenerationStrategy(IConventionModel, NpgsqlValueGenerationStrategy?, bool)

    Attempts to set the NpgsqlValueGenerationStrategy to use for properties of keys in the model that don't have a strategy explicitly set.

    Declaration
    public static NpgsqlValueGenerationStrategy? SetValueGenerationStrategy(this IConventionModel model, NpgsqlValueGenerationStrategy? value, bool fromDataAnnotation = false)
    Parameters
    Type Name Description
    IConventionModel model

    The model.

    NpgsqlValueGenerationStrategy? value

    The value to set.

    bool fromDataAnnotation

    Indicates whether the configuration was specified using a data annotation.

    Returns
    Type Description
    NpgsqlValueGenerationStrategy?
    Remarks

    See Modeling entity types and relationships.

    | Improve this Doc View Source

    SetValueGenerationStrategy(IMutableModel, NpgsqlValueGenerationStrategy?)

    Attempts to set the NpgsqlValueGenerationStrategy to use for properties of keys in the model that don't have a strategy explicitly set.

    Declaration
    public static void SetValueGenerationStrategy(this IMutableModel model, NpgsqlValueGenerationStrategy? value)
    Parameters
    Type Name Description
    IMutableModel model

    The model.

    NpgsqlValueGenerationStrategy? value

    The value to set.

    Remarks

    See Modeling entity types and relationships.

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