Table of Contents

Class NpgsqlValueGenerationConvention

Namespace
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.Conventions
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.dll

A convention that configures store value generation as OnAdd on properties that are part of the primary key and not part of any foreign keys, were configured to have a database default value or were configured to use a NpgsqlValueGenerationStrategy. It also configures properties as OnAddOrUpdate if they were configured as computed columns.

public class NpgsqlValueGenerationConvention : RelationalValueGenerationConvention, IEntityTypePrimaryKeyChangedConvention, IForeignKeyAddedConvention, IForeignKeyRemovedConvention, IForeignKeyPropertiesChangedConvention, IEntityTypeBaseTypeChangedConvention, IForeignKeyOwnershipChangedConvention, IPropertyAnnotationChangedConvention, IEntityTypeAnnotationChangedConvention, IConvention
Inheritance
NpgsqlValueGenerationConvention
Implements
Inherited Members

Constructors

NpgsqlValueGenerationConvention(ProviderConventionSetBuilderDependencies, RelationalConventionSetBuilderDependencies)

Creates a new instance of NpgsqlValueGenerationConvention.

public NpgsqlValueGenerationConvention(ProviderConventionSetBuilderDependencies dependencies, RelationalConventionSetBuilderDependencies relationalDependencies)

Parameters

dependencies ProviderConventionSetBuilderDependencies

Parameter object containing dependencies for this convention.

relationalDependencies RelationalConventionSetBuilderDependencies

Parameter object containing relational dependencies for this convention.

Methods

GetValueGenerated(IConventionProperty)

Returns the store value generation strategy to set for the given property.

protected override ValueGenerated? GetValueGenerated(IConventionProperty property)

Parameters

property IConventionProperty

The property.

Returns

ValueGenerated?

The store value generation strategy to set for the given property.

GetValueGenerated(IReadOnlyProperty, in StoreObjectIdentifier)

Returns the store value generation strategy to set for the given property.

public static ValueGenerated? GetValueGenerated(IReadOnlyProperty property, in StoreObjectIdentifier storeObject)

Parameters

property IReadOnlyProperty

The property.

storeObject StoreObjectIdentifier

The identifier of the store object.

Returns

ValueGenerated?

The store value generation strategy to set for the given property.

ProcessPropertyAnnotationChanged(IConventionPropertyBuilder, string, IConventionAnnotation?, IConventionAnnotation?, IConventionContext<IConventionAnnotation>)

Called after an annotation is changed on a property.

public override void ProcessPropertyAnnotationChanged(IConventionPropertyBuilder propertyBuilder, string name, IConventionAnnotation? annotation, IConventionAnnotation? oldAnnotation, IConventionContext<IConventionAnnotation> context)

Parameters

propertyBuilder IConventionPropertyBuilder

The builder for the property.

name string

The annotation name.

annotation IConventionAnnotation

The new annotation.

oldAnnotation IConventionAnnotation

The old annotation.

context IConventionContext<IConventionAnnotation>

Additional information associated with convention execution.