Class NpgsqlValueGenerationConvention
- 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
ProviderConventionSetBuilderDependenciesParameter object containing dependencies for this convention.
relationalDependencies
RelationalConventionSetBuilderDependenciesParameter 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
IConventionPropertyThe 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
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe 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
IConventionPropertyBuilderThe builder for the property.
name
stringThe annotation name.
annotation
IConventionAnnotationThe new annotation.
oldAnnotation
IConventionAnnotationThe old annotation.
context
IConventionContext<IConventionAnnotation>Additional information associated with convention execution.