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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
compressionMethodstringThe compression method.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
trueif 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
trueif 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
startValuelong?The starting value for the sequence. The default starting value is
minValuefor ascending sequences andmaxValuefor descending ones.incrementBylong?The amount to increment between values. Defaults to 1.
minValuelong?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.
maxValuelong?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.
cyclicbool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCachelong?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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
configstringThe text search configuration for this generated tsvector property, or
nullif this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
includedPropertyNamesIReadOnlyList<string>An array of property names to be included in the tsvector.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
trueif 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
fromDataAnnotationboolIndicates 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
valueGenerationStrategyNpgsqlValueGenerationStrategy?The value generation strategy.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- bool
trueif 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
fromDataAnnotationboolIndicates 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
startValuelong?The starting value for the sequence. The default starting value is
minValuefor ascending sequences andmaxValuefor descending ones.incrementBylong?The amount to increment between values. Defaults to 1.
minValuelong?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.
maxValuelong?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.
cyclicbool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCachelong?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
propertyBuilderPropertyBuilderThe builder for the property being configured.
startValuelong?The starting value for the sequence. The default starting value is
minValuefor ascending sequences andmaxValuefor descending ones.incrementBylong?The amount to increment between values. Defaults to 1.
minValuelong?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.
maxValuelong?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.
cyclicbool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCachelong?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
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
startValuelong?The starting value for the sequence. The default starting value is
minValuefor ascending sequences andmaxValuefor descending ones.incrementBylong?The amount to increment between values. Defaults to 1.
minValuelong?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.
maxValuelong?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.
cyclicbool?Sets whether or not the sequence will start again from the beginning once the maximum value is reached. Defaults to false.
numbersToCachelong?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
propertyBuilderPropertyBuilder<List<TElementProperty>>elementValueConverterValueConverter
Returns
- PropertyBuilder<List<TElementProperty>>
Type Parameters
TElementPropertyTElementProvider
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
propertyBuilderPropertyBuilder<List<TElementProperty>>convertToProviderExpressionExpression<Func<TElementProperty, TElementProvider>>convertFromProviderExpressionExpression<Func<TElementProvider, TElementProperty>>
Returns
- PropertyBuilder<List<TElementProperty>>
Type Parameters
TElementPropertyTElementProvider
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
propertyBuilderPropertyBuilder<TElementProperty[]>elementValueConverterValueConverter
Returns
- PropertyBuilder<TElementProperty[]>
Type Parameters
TElementPropertyTElementProvider
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
propertyBuilderPropertyBuilder<TElementProperty[]>convertToProviderExpressionExpression<Func<TElementProperty, TElementProvider>>convertFromProviderExpressionExpression<Func<TElementProvider, TElementProperty>>
Returns
- PropertyBuilder<TElementProperty[]>
Type Parameters
TElementPropertyTElementProvider
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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
fromDataAnnotationboolIndicates 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
valueGenerationStrategyNpgsqlValueGenerationStrategy?The value generation strategy.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied,
nullotherwise.
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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
configstringThe text search configuration for this generated tsvector property.
See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
includedPropertyNamesIReadOnlyList<string>An array of property names to be included in the tsvector.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied,
nullotherwise.
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
propertyBuilderPropertyBuilderThe builder for the property being configured.
configstringThe text search configuration for this generated tsvector property, or
nullif this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
includedPropertyNamesstring[]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
propertyBuilderPropertyBuilder<NpgsqlTsVector>The builder for the property being configured.
configstringThe text search configuration for this generated tsvector property, or
nullif this is not a generated tsvector property.See https://www.postgresql.org/docs/current/textsearch-controls.html for more information.
includedPropertyNamesstring[]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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
compressionMethodstringThe compression method.
fromDataAnnotationboolIndicates 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
propertyBuilderPropertyBuilderThe builder for the property being configured.
compressionMethodstringThe 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
propertyBuilderPropertyBuilder<TEntity>The builder for the property being configured.
compressionMethodstringThe 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
propertyBuilderPropertyBuilderThe builder for the property being configured.
namestringThe comment of the sequence.
schemastringThe 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
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
namestringThe comment of the sequence.
schemastringThe 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
propertyBuilderPropertyBuilderThe 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
propertyBuilderPropertyBuilder<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
propertyBuilderPropertyBuilderThe 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
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe 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
propertyBuilderPropertyBuilderThe 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
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe 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
propertyBuilderPropertyBuilderThe builder for the property being configured.
namestringThe name of the sequence.
schemastringThe 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
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe 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
propertyBuilderPropertyBuilderThe 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
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.