Class NpgsqlModelExtensions
Model extension methods for Npgsql-specific metadata.
Namespace: Microsoft.EntityFrameworkCore
Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
Syntax
public static class NpgsqlModelExtensions
Remarks
Fields
| Improve this Doc View SourceDefaultHiLoSequenceName
The default name for the hi-lo sequence.
Declaration
public const string DefaultHiLoSequenceName
Field Value
Type | Description |
---|---|
string |
Remarks
| Improve this Doc View SourceDefaultSequenceNameSuffix
The default prefix for sequences applied to properties.
Declaration
public const string DefaultSequenceNameSuffix
Field Value
Type | Description |
---|---|
string |
Remarks
Methods
| Improve this Doc View SourceGetCollations(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
| Improve this Doc View SourceGetDatabaseTemplate(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
| Improve this Doc View SourceGetDatabaseTemplateConfigurationSource(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
| Improve this Doc View SourceGetDefaultColumnCollation(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 more information, see https://www.postgresql.org/docs/current/collation.html.
GetDefaultColumnCollationConfigurationSource(IConventionModel)
Returns the
Declaration
public static ConfigurationSource? GetDefaultColumnCollationConfigurationSource(this IConventionModel model)
Parameters
Type | Name | Description |
---|---|---|
IConventionModel | model | The model. |
Returns
Type | Description |
---|---|
ConfigurationSource? | The |
Remarks
| Improve this Doc View SourceGetHiLoSequenceName(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
| Improve this Doc View SourceGetHiLoSequenceNameConfigurationSource(IConventionModel)
Returns the
Declaration
public static ConfigurationSource? GetHiLoSequenceNameConfigurationSource(this IConventionModel model)
Parameters
Type | Name | Description |
---|---|---|
IConventionModel | model | The model. |
Returns
Type | Description |
---|---|
ConfigurationSource? | The |
Remarks
| Improve this Doc View SourceGetHiLoSequenceSchema(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
| Improve this Doc View SourceGetHiLoSequenceSchemaConfigurationSource(IConventionModel)
Returns the
Declaration
public static ConfigurationSource? GetHiLoSequenceSchemaConfigurationSource(this IConventionModel model)
Parameters
Type | Name | Description |
---|---|---|
IConventionModel | model | The model. |
Returns
Type | Description |
---|---|
ConfigurationSource? | The |
Remarks
| Improve this Doc View SourceGetOrAddCollation(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
| Improve this Doc View SourceGetOrAddPostgresEnum(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
| Improve this Doc View SourceGetOrAddPostgresExtension(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
| Improve this Doc View SourceGetOrAddPostgresExtension(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
| Improve this Doc View SourceGetOrAddPostgresRange(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
| Improve this Doc View SourceGetPostgresEnums(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
| Improve this Doc View SourceGetPostgresExtensions(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
| Improve this Doc View SourceGetSequenceNameSuffix(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
| Improve this Doc View SourceGetSequenceNameSuffixConfigurationSource(IConventionModel)
Returns the
Declaration
public static ConfigurationSource? GetSequenceNameSuffixConfigurationSource(this IConventionModel model)
Parameters
Type | Name | Description |
---|---|---|
IConventionModel | model | The model. |
Returns
Type | Description |
---|---|
ConfigurationSource? | The |
Remarks
| Improve this Doc View SourceGetSequenceSchema(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
| Improve this Doc View SourceGetSequenceSchemaConfigurationSource(IConventionModel)
Returns the
Declaration
public static ConfigurationSource? GetSequenceSchemaConfigurationSource(this IConventionModel model)
Parameters
Type | Name | Description |
---|---|---|
IConventionModel | model | The model. |
Returns
Type | Description |
---|---|
ConfigurationSource? | The |
Remarks
| Improve this Doc View SourceGetTablespace(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
| Improve this Doc View SourceGetTablespaceConfigurationSource(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
| Improve this Doc View SourceGetValueGenerationStrategy(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
| Improve this Doc View SourceGetValueGenerationStrategyConfigurationSource(IConventionModel)
Returns the
Declaration
public static ConfigurationSource? GetValueGenerationStrategyConfigurationSource(this IConventionModel model)
Parameters
Type | Name | Description |
---|---|---|
IConventionModel | model | The model. |
Returns
Type | Description |
---|---|
ConfigurationSource? | The |
Remarks
| Improve this Doc View SourcePostgresRanges(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
| Improve this Doc View SourceSetDatabaseTemplate(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
| Improve this Doc View SourceSetDatabaseTemplate(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
| Improve this Doc View SourceSetDefaultColumnCollation(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 more information, see https://www.postgresql.org/docs/current/collation.html.
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 more information, see https://www.postgresql.org/docs/current/collation.html.
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
| Improve this Doc View SourceSetHiLoSequenceName(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
| Improve this Doc View SourceSetHiLoSequenceSchema(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
| Improve this Doc View SourceSetHiLoSequenceSchema(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
| Improve this Doc View SourceSetSequenceNameSuffix(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
| Improve this Doc View SourceSetSequenceNameSuffix(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
| Improve this Doc View SourceSetSequenceSchema(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
| Improve this Doc View SourceSetSequenceSchema(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
| Improve this Doc View SourceSetTablespace(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
| Improve this Doc View SourceSetTablespace(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
| Improve this Doc View SourceSetValueGenerationStrategy(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
| Improve this Doc View SourceSetValueGenerationStrategy(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. |