Class NpgsqlPropertyBuilderExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Npgsql.EntityFrameworkCore.PostgreSQL.dll
Npgsql specific extension methods for PropertyBuilder.
public static class NpgsqlPropertyBuilderExtensions
- Inheritance
-
NpgsqlPropertyBuilderExtensions
- Inherited Members
Methods
CanSetCompressionMethod(IConventionPropertyBuilder, string?, bool)
Whether the compression method for the column can be set.
public static bool CanSetCompressionMethod(this IConventionPropertyBuilder propertyBuilder, string? compressionMethod, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
compressionMethod
stringThe compression method.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the index can be configured with the method
Remarks
This feature was introduced in PostgreSQL 14.
CanSetHiLoSequence(IConventionPropertyBuilder, string?, string?, bool)
Returns a value indicating whether the given name and schema can be set for the hi-lo sequence.
public static bool CanSetHiLoSequence(this IConventionPropertyBuilder propertyBuilder, string? name, string? schema, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the given name and schema can be set for the hi-lo sequence.
CanSetIdentityOptions(IConventionPropertyBuilder, long?, long?, long?, long?, bool?, long?)
Returns a value indicating whether the sequence options can be set on the identity column.
public static bool CanSetIdentityOptions(this IConventionPropertyBuilder propertyBuilder, long? startValue = null, long? incrementBy = null, long? minValue = null, long? maxValue = null, bool? cyclic = null, long? numbersToCache = null)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
startValue
long?The starting value for the sequence. The default starting value is
minValue
for ascending sequences andmaxValue
for descending ones.incrementBy
long?The amount to increment between values. Defaults to 1.
minValue
long?The minimum value for the sequence. The default for an ascending sequence is 1. The default for a descending sequence is the minimum value of the data type.
maxValue
long?The maximum value for the sequence. The default for an ascending sequence is the maximum value of the data type. The default for a descending sequence is -1.
cyclic
bool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCache
long?Specifies how many sequence numbers are to be pre-allocated and stored in memory for faster access. The minimum value is 1 (only one value can be generated at a time, i.e., no cache), and this is also the default.
Returns
- bool
The same builder instance so that multiple calls can be chained.
CanSetIsGeneratedTsVectorColumn(IConventionPropertyBuilder, string?, IReadOnlyList<string>?, bool)
Returns a value indicating whether the property can be configured as a full-text search tsvector column.
public static bool CanSetIsGeneratedTsVectorColumn(this IConventionPropertyBuilder propertyBuilder, string? config, IReadOnlyList<string>? includedPropertyNames, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
config
stringThe 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.
includedPropertyNames
IReadOnlyList<string>An array of property names to be included in the tsvector.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the property can be configured as a full-text search tsvector column.
CanSetSequence(IConventionPropertyBuilder, string?, string?, bool)
Returns a value indicating whether the given name and schema can be set for the key value generation sequence.
public static bool CanSetSequence(this IConventionPropertyBuilder propertyBuilder, string? name, string? schema, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
CanSetValueGenerationStrategy(IConventionPropertyBuilder, NpgsqlValueGenerationStrategy?, in StoreObjectIdentifier, bool)
Returns a value indicating whether the given value can be set as the value generation strategy for a particular table.
public static bool CanSetValueGenerationStrategy(this IConventionPropertyBuilder propertyBuilder, NpgsqlValueGenerationStrategy? valueGenerationStrategy, in StoreObjectIdentifier storeObject, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
valueGenerationStrategy
NpgsqlValueGenerationStrategy?The value generation strategy.
storeObject
StoreObjectIdentifierThe table identifier.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
CanSetValueGenerationStrategy(IConventionPropertyBuilder, NpgsqlValueGenerationStrategy?, bool)
Returns a value indicating whether the given value can be set as the value generation strategy.
public static bool CanSetValueGenerationStrategy(this IConventionPropertyBuilder propertyBuilder, NpgsqlValueGenerationStrategy? valueGenerationStrategy, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
valueGenerationStrategy
NpgsqlValueGenerationStrategy?The value generation strategy.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
true
if the given value can be set as the default value generation strategy.
HasHiLoSequence(IConventionPropertyBuilder, string?, string?, bool)
Configures the database sequence used for the hi-lo pattern to generate values for the key property, when targeting SQL Server.
public static IConventionSequenceBuilder? HasHiLoSequence(this IConventionPropertyBuilder propertyBuilder, string? name, string? schema, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionSequenceBuilder
A builder to further configure the sequence.
HasIdentityOptions(IConventionPropertyBuilder, long?, long?, long?, long?, bool?, long?)
Sets the sequence options on an identity column. The column must be set as identity via UseIdentityColumn(PropertyBuilder) or UseIdentityAlwaysColumn(PropertyBuilder).
public static IConventionPropertyBuilder? HasIdentityOptions(this IConventionPropertyBuilder propertyBuilder, long? startValue = null, long? incrementBy = null, long? minValue = null, long? maxValue = null, bool? cyclic = null, long? numbersToCache = null)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
startValue
long?The starting value for the sequence. The default starting value is
minValue
for ascending sequences andmaxValue
for descending ones.incrementBy
long?The amount to increment between values. Defaults to 1.
minValue
long?The minimum value for the sequence. The default for an ascending sequence is 1. The default for a descending sequence is the minimum value of the data type.
maxValue
long?The maximum value for the sequence. The default for an ascending sequence is the maximum value of the data type. The default for a descending sequence is -1.
cyclic
bool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCache
long?Specifies how many sequence numbers are to be pre-allocated and stored in memory for faster access. The minimum value is 1 (only one value can be generated at a time, i.e., no cache), and this is also the default.
Returns
- IConventionPropertyBuilder
The same builder instance so that multiple calls can be chained.
HasIdentityOptions(PropertyBuilder, long?, long?, long?, long?, bool?, long?)
Sets the sequence options on an identity column. The column must be set as identity via UseIdentityColumn(PropertyBuilder) or UseIdentityAlwaysColumn(PropertyBuilder).
public static PropertyBuilder HasIdentityOptions(this PropertyBuilder propertyBuilder, long? startValue = null, long? incrementBy = null, long? minValue = null, long? maxValue = null, bool? cyclic = null, long? numbersToCache = null)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
startValue
long?The starting value for the sequence. The default starting value is
minValue
for ascending sequences andmaxValue
for descending ones.incrementBy
long?The amount to increment between values. Defaults to 1.
minValue
long?The minimum value for the sequence. The default for an ascending sequence is 1. The default for a descending sequence is the minimum value of the data type.
maxValue
long?The maximum value for the sequence. The default for an ascending sequence is the maximum value of the data type. The default for a descending sequence is -1.
cyclic
bool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCache
long?Specifies how many sequence numbers are to be pre0allocated and stored in memory for faster access. The minimum value is 1 (only one value can be generated at a time, i.e., no cache), and this is also the default.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
HasIdentityOptions<TProperty>(PropertyBuilder<TProperty>, long?, long?, long?, long?, bool?, long?)
Sets the sequence options on an identity column. The column must be set as identity via UseIdentityColumn(PropertyBuilder) or UseIdentityAlwaysColumn(PropertyBuilder).
public static PropertyBuilder<TProperty> HasIdentityOptions<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, long? startValue = null, long? incrementBy = null, long? minValue = null, long? maxValue = null, bool? cyclic = null, long? numbersToCache = null)
Parameters
propertyBuilder
PropertyBuilder<TProperty>The builder for the property being configured.
startValue
long?The starting value for the sequence. The default starting value is
minValue
for ascending sequences andmaxValue
for descending ones.incrementBy
long?The amount to increment between values. Defaults to 1.
minValue
long?The minimum value for the sequence. The default for an ascending sequence is 1. The default for a descending sequence is the minimum value of the data type.
maxValue
long?The maximum value for the sequence. The default for an ascending sequence is the maximum value of the data type. The default for a descending sequence is -1.
cyclic
bool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCache
long?Specifies how many sequence numbers are to be pre-allocated and stored in memory for faster access. The minimum value is 1 (only one value can be generated at a time, i.e., no cache), and this is also the default.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
HasPostgresArrayConversion<TElementProperty, TElementProvider>(PropertyBuilder<List<TElementProperty>>, ValueConverter)
Configures a PostgreSQL array conversion.
[Obsolete("HasPostgresArrayConversion has been replaced with the standard EF 8 primitive collection API, see https://www.npgsql.org/efcore/release-notes/8.0.html", true)]
public static PropertyBuilder<List<TElementProperty>> HasPostgresArrayConversion<TElementProperty, TElementProvider>(this PropertyBuilder<List<TElementProperty>> propertyBuilder, ValueConverter elementValueConverter)
Parameters
propertyBuilder
PropertyBuilder<List<TElementProperty>>elementValueConverter
ValueConverter
Returns
- PropertyBuilder<List<TElementProperty>>
Type Parameters
TElementProperty
TElementProvider
HasPostgresArrayConversion<TElementProperty, TElementProvider>(PropertyBuilder<List<TElementProperty>>, Expression<Func<TElementProperty, TElementProvider>>, Expression<Func<TElementProvider, TElementProperty>>)
Configures a PostgreSQL array conversion.
[Obsolete("HasPostgresArrayConversion has been replaced with the standard EF 8 primitive collection API, see https://www.npgsql.org/efcore/release-notes/8.0.html", true)]
public static PropertyBuilder<List<TElementProperty>> HasPostgresArrayConversion<TElementProperty, TElementProvider>(this PropertyBuilder<List<TElementProperty>> propertyBuilder, Expression<Func<TElementProperty, TElementProvider>> convertToProviderExpression, Expression<Func<TElementProvider, TElementProperty>> convertFromProviderExpression)
Parameters
propertyBuilder
PropertyBuilder<List<TElementProperty>>convertToProviderExpression
Expression<Func<TElementProperty, TElementProvider>>convertFromProviderExpression
Expression<Func<TElementProvider, TElementProperty>>
Returns
- PropertyBuilder<List<TElementProperty>>
Type Parameters
TElementProperty
TElementProvider
HasPostgresArrayConversion<TElementProperty, TElementProvider>(PropertyBuilder<TElementProperty[]>, ValueConverter)
Configures a PostgreSQL array conversion.
[Obsolete("HasPostgresArrayConversion has been replaced with the standard EF 8 primitive collection API, see https://www.npgsql.org/efcore/release-notes/8.0.html", true)]
public static PropertyBuilder<TElementProperty[]> HasPostgresArrayConversion<TElementProperty, TElementProvider>(this PropertyBuilder<TElementProperty[]> propertyBuilder, ValueConverter elementValueConverter)
Parameters
propertyBuilder
PropertyBuilder<TElementProperty[]>elementValueConverter
ValueConverter
Returns
- PropertyBuilder<TElementProperty[]>
Type Parameters
TElementProperty
TElementProvider
HasPostgresArrayConversion<TElementProperty, TElementProvider>(PropertyBuilder<TElementProperty[]>, Expression<Func<TElementProperty, TElementProvider>>, Expression<Func<TElementProvider, TElementProperty>>)
Configures a PostgreSQL array conversion.
[Obsolete("HasPostgresArrayConversion has been replaced with the standard EF 8 primitive collection API, see https://www.npgsql.org/efcore/release-notes/8.0.html", true)]
public static PropertyBuilder<TElementProperty[]> HasPostgresArrayConversion<TElementProperty, TElementProvider>(this PropertyBuilder<TElementProperty[]> propertyBuilder, Expression<Func<TElementProperty, TElementProvider>> convertToProviderExpression, Expression<Func<TElementProvider, TElementProperty>> convertFromProviderExpression)
Parameters
propertyBuilder
PropertyBuilder<TElementProperty[]>convertToProviderExpression
Expression<Func<TElementProperty, TElementProvider>>convertFromProviderExpression
Expression<Func<TElementProvider, TElementProperty>>
Returns
- PropertyBuilder<TElementProperty[]>
Type Parameters
TElementProperty
TElementProvider
HasSequence(IConventionPropertyBuilder, string?, string?, bool)
Configures the database sequence used for the key value generation pattern to generate values for the key property, when targeting PostgreSQL.
public static IConventionSequenceBuilder? HasSequence(this IConventionPropertyBuilder propertyBuilder, string? name, string? schema, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionSequenceBuilder
A builder to further configure the sequence.
HasValueGenerationStrategy(IConventionPropertyBuilder, NpgsqlValueGenerationStrategy?, bool)
Configures the value generation strategy for the key property, when targeting PostgreSQL.
public static IConventionPropertyBuilder? HasValueGenerationStrategy(this IConventionPropertyBuilder propertyBuilder, NpgsqlValueGenerationStrategy? valueGenerationStrategy, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
valueGenerationStrategy
NpgsqlValueGenerationStrategy?The value generation strategy.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied,
null
otherwise.
IsGeneratedTsVectorColumn(IConventionPropertyBuilder, string, IReadOnlyList<string>, bool)
Configures the property to be a full-text search tsvector column over the given properties.
public static IConventionPropertyBuilder? IsGeneratedTsVectorColumn(this IConventionPropertyBuilder propertyBuilder, string config, IReadOnlyList<string> includedPropertyNames, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
config
stringThe text search configuration for this generated tsvector property.
See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
includedPropertyNames
IReadOnlyList<string>An array of property names to be included in the tsvector.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied,
null
otherwise.
IsGeneratedTsVectorColumn(PropertyBuilder, string, params string[])
Configures the property to be a full-text search tsvector column over the given properties.
public static PropertyBuilder IsGeneratedTsVectorColumn(this PropertyBuilder propertyBuilder, string config, params string[] includedPropertyNames)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
config
stringThe 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.
includedPropertyNames
string[]An array of property names to be included in the tsvector.
Returns
- PropertyBuilder
A builder to further configure the property.
IsGeneratedTsVectorColumn(PropertyBuilder<NpgsqlTsVector>, string, params string[])
Configures the property to be a full-text search tsvector column over the given properties.
public static PropertyBuilder<NpgsqlTsVector> IsGeneratedTsVectorColumn(this PropertyBuilder<NpgsqlTsVector> propertyBuilder, string config, params string[] includedPropertyNames)
Parameters
propertyBuilder
PropertyBuilder<NpgsqlTsVector>The builder for the property being configured.
config
stringThe 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.
includedPropertyNames
string[]An array of property names to be included in the tsvector.
Returns
- PropertyBuilder<NpgsqlTsVector>
A builder to further configure the property.
UseCompressionMethod(IConventionPropertyBuilder, string?, bool)
Sets the compression method for the column.
public static IConventionPropertyBuilder? UseCompressionMethod(this IConventionPropertyBuilder propertyBuilder, string? compressionMethod, bool fromDataAnnotation = false)
Parameters
propertyBuilder
IConventionPropertyBuilderThe builder for the property being configured.
compressionMethod
stringThe compression method.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
A builder to further configure the property.
Remarks
This feature was introduced in PostgreSQL 14.
UseCompressionMethod(PropertyBuilder, string?)
Sets the compression method for the column.
public static PropertyBuilder UseCompressionMethod(this PropertyBuilder propertyBuilder, string? compressionMethod)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
compressionMethod
stringThe compression method.
Returns
- PropertyBuilder
A builder to further configure the property.
Remarks
This feature was introduced in PostgreSQL 14.
UseCompressionMethod<TEntity>(PropertyBuilder<TEntity>, string?)
Sets the compression method for the column.
public static PropertyBuilder<TEntity> UseCompressionMethod<TEntity>(this PropertyBuilder<TEntity> propertyBuilder, string? compressionMethod)
Parameters
propertyBuilder
PropertyBuilder<TEntity>The builder for the property being configured.
compressionMethod
stringThe compression method.
Returns
- PropertyBuilder<TEntity>
A builder to further configure the property.
Type Parameters
TEntity
Remarks
This feature was introduced in PostgreSQL 14.
UseHiLo(PropertyBuilder, string?, string?)
Configures the property to use a sequence-based hi-lo pattern to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd.
public static PropertyBuilder UseHiLo(this PropertyBuilder propertyBuilder, string? name = null, string? schema = null)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
name
stringThe comment of the sequence.
schema
stringThe schema of the sequence.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
UseHiLo<TProperty>(PropertyBuilder<TProperty>, string?, string?)
Configures the property to use a sequence-based hi-lo pattern to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd.
public static PropertyBuilder<TProperty> UseHiLo<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? name = null, string? schema = null)
Parameters
propertyBuilder
PropertyBuilder<TProperty>The builder for the property being configured.
name
stringThe comment of the sequence.
schema
stringThe schema of the sequence.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
UseIdentityAlwaysColumn(PropertyBuilder)
Configures the property to use the PostgreSQL IDENTITY feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd. Values for this property will always be generated as identity, and the application will not be able to override this behavior by providing a value.
Available only starting PostgreSQL 10.
public static PropertyBuilder UseIdentityAlwaysColumn(this PropertyBuilder propertyBuilder)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
UseIdentityAlwaysColumn<TProperty>(PropertyBuilder<TProperty>)
Configures the property to use the PostgreSQL IDENTITY feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd. Values for this property will always be generated as identity, and the application will not be able to override this behavior by providing a value.
Available only starting PostgreSQL 10.
public static PropertyBuilder<TProperty> UseIdentityAlwaysColumn<TProperty>(this PropertyBuilder<TProperty> propertyBuilder)
Parameters
propertyBuilder
PropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
UseIdentityByDefaultColumn(PropertyBuilder)
Configures the property to use the PostgreSQL IDENTITY feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd. Values for this property will be generated as identity by default, but the application will be able to override this behavior by providing a value.
This is the default behavior when targeting PostgreSQL. Available only starting PostgreSQL 10.
public static PropertyBuilder UseIdentityByDefaultColumn(this PropertyBuilder propertyBuilder)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
UseIdentityByDefaultColumn<TProperty>(PropertyBuilder<TProperty>)
Configures the property to use the PostgreSQL IDENTITY feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd. Values for this property will be generated as identity by default, but the application will be able to override this behavior by providing a value.
This is the default behavior when targeting PostgreSQL. Available only starting PostgreSQL 10.
public static PropertyBuilder<TProperty> UseIdentityByDefaultColumn<TProperty>(this PropertyBuilder<TProperty> propertyBuilder)
Parameters
propertyBuilder
PropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
The type of the property being configured.
UseIdentityColumn(PropertyBuilder)
Configures the property to use the PostgreSQL IDENTITY feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd. Values for this property will be generated as identity by default, but the application will be able to override this behavior by providing a value.
This internally calls UseIdentityByDefaultColumn(PropertyBuilder). This is the default behavior when targeting PostgreSQL. Available only starting PostgreSQL 10.
public static PropertyBuilder UseIdentityColumn(this PropertyBuilder propertyBuilder)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
UseIdentityColumn<TProperty>(PropertyBuilder<TProperty>)
Configures the property to use the PostgreSQL IDENTITY feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd. Values for this property will be generated as identity by default, but the application will be able to override this behavior by providing a value.
This internally calls UseIdentityByDefaultColumn(PropertyBuilder). This is the default behavior when targeting PostgreSQL. Available only starting PostgreSQL 10.
public static PropertyBuilder<TProperty> UseIdentityColumn<TProperty>(this PropertyBuilder<TProperty> propertyBuilder)
Parameters
propertyBuilder
PropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
The type of the property being configured.
UseSequence(PropertyBuilder, string?, string?)
Configures the key property to use a sequence-based key value generation pattern to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd.
public static PropertyBuilder UseSequence(this PropertyBuilder propertyBuilder, string? name = null, string? schema = null)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
UseSequence<TProperty>(PropertyBuilder<TProperty>, string?, string?)
Configures the key property to use a sequence-based key value generation pattern to generate values for new entities, when targeting SQL Server. This method sets the property to be OnAdd.
public static PropertyBuilder<TProperty> UseSequence<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? name = null, string? schema = null)
Parameters
propertyBuilder
PropertyBuilder<TProperty>The builder for the property being configured.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
The type of the property being configured.
Remarks
See Modeling entity types and relationships, and Accessing SQL Server and SQL Azure databases with EF Core for more information and examples.
UseSerialColumn(PropertyBuilder)
Configures the property to use the PostgreSQL SERIAL feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd.
public static PropertyBuilder UseSerialColumn(this PropertyBuilder propertyBuilder)
Parameters
propertyBuilder
PropertyBuilderThe builder for the property being configured.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
UseSerialColumn<TProperty>(PropertyBuilder<TProperty>)
Configures the property to use the PostgreSQL SERIAL feature to generate values for new entities, when targeting PostgreSQL. This method sets the property to be OnAdd.
public static PropertyBuilder<TProperty> UseSerialColumn<TProperty>(this PropertyBuilder<TProperty> propertyBuilder)
Parameters
propertyBuilder
PropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
The type of the property being configured.