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
dependenciesProviderConventionSetBuilderDependenciesParameter object containing dependencies for this convention.
relationalDependenciesRelationalConventionSetBuilderDependenciesParameter 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
propertyIConventionPropertyThe 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
propertyIReadOnlyPropertyThe property.
storeObjectStoreObjectIdentifierThe 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
propertyBuilderIConventionPropertyBuilderThe builder for the property.
namestringThe annotation name.
annotationIConventionAnnotationThe new annotation.
oldAnnotationIConventionAnnotationThe old annotation.
contextIConventionContext<IConventionAnnotation>Additional information associated with convention execution.