Class ValueGenerationConvention
- Namespace
- Microsoft.EntityFrameworkCore.Metadata.Conventions
- Assembly
- Microsoft.EntityFrameworkCore.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.
public class ValueGenerationConvention : IEntityTypePrimaryKeyChangedConvention, IForeignKeyAddedConvention, IForeignKeyRemovedConvention, IForeignKeyPropertiesChangedConvention, IEntityTypeBaseTypeChangedConvention, IForeignKeyOwnershipChangedConvention, IConvention
- Inheritance
-
ValueGenerationConvention
- Implements
- Inherited Members
Remarks
See Model building conventions for more information and examples.
Constructors
ValueGenerationConvention(ProviderConventionSetBuilderDependencies)
Creates a new instance of ValueGenerationConvention.
public ValueGenerationConvention(ProviderConventionSetBuilderDependencies dependencies)
Parameters
dependencies
ProviderConventionSetBuilderDependenciesParameter object containing dependencies for this convention.
Properties
Dependencies
Dependencies for this service.
protected virtual ProviderConventionSetBuilderDependencies Dependencies { get; }
Property Value
Methods
GetValueGenerated(IConventionProperty)
Returns the store value generation strategy to set for the given property.
protected virtual ValueGenerated? GetValueGenerated(IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ValueGenerated?
The store value generation strategy to set for the given property.
GetValueGenerated(IReadOnlyProperty)
Returns the store value generation strategy to set for the given property.
public static ValueGenerated? GetValueGenerated(IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- ValueGenerated?
The store value generation strategy to set for the given property.
ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder, IConventionEntityType?, IConventionEntityType?, IConventionContext<IConventionEntityType>)
Called after the base type of an entity type changes.
public virtual void ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder entityTypeBuilder, IConventionEntityType? newBaseType, IConventionEntityType? oldBaseType, IConventionContext<IConventionEntityType> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
newBaseType
IConventionEntityTypeThe new base entity type.
oldBaseType
IConventionEntityTypeThe old base entity type.
context
IConventionContext<IConventionEntityType>Additional information associated with convention execution.
ProcessEntityTypePrimaryKeyChanged(IConventionEntityTypeBuilder, IConventionKey?, IConventionKey?, IConventionContext<IConventionKey>)
Called after the primary key for an entity type is changed.
public virtual void ProcessEntityTypePrimaryKeyChanged(IConventionEntityTypeBuilder entityTypeBuilder, IConventionKey? newPrimaryKey, IConventionKey? previousPrimaryKey, IConventionContext<IConventionKey> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
newPrimaryKey
IConventionKeyThe new primary key.
previousPrimaryKey
IConventionKeyThe old primary key.
context
IConventionContext<IConventionKey>Additional information associated with convention execution.
ProcessForeignKeyAdded(IConventionForeignKeyBuilder, IConventionContext<IConventionForeignKeyBuilder>)
Called after a foreign key is added to the entity type.
public virtual void ProcessForeignKeyAdded(IConventionForeignKeyBuilder relationshipBuilder, IConventionContext<IConventionForeignKeyBuilder> context)
Parameters
relationshipBuilder
IConventionForeignKeyBuilderThe builder for the foreign key.
context
IConventionContext<IConventionForeignKeyBuilder>Additional information associated with convention execution.
ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder, IConventionContext<bool?>)
Called after the ownership value for a foreign key is changed.
public virtual void ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder relationshipBuilder, IConventionContext<bool?> context)
Parameters
relationshipBuilder
IConventionForeignKeyBuilderThe builder for the foreign key.
context
IConventionContext<bool?>Additional information associated with convention execution.
ProcessForeignKeyPropertiesChanged(IConventionForeignKeyBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IReadOnlyList<IConventionProperty>>)
Called after the foreign key properties or principal key are changed.
public virtual void ProcessForeignKeyPropertiesChanged(IConventionForeignKeyBuilder relationshipBuilder, IReadOnlyList<IConventionProperty> oldDependentProperties, IConventionKey oldPrincipalKey, IConventionContext<IReadOnlyList<IConventionProperty>> context)
Parameters
relationshipBuilder
IConventionForeignKeyBuilderThe builder for the foreign key.
oldDependentProperties
IReadOnlyList<IConventionProperty>The old foreign key properties.
oldPrincipalKey
IConventionKeyThe old principal key.
context
IConventionContext<IReadOnlyList<IConventionProperty>>Additional information associated with convention execution.
ProcessForeignKeyRemoved(IConventionEntityTypeBuilder, IConventionForeignKey, IConventionContext<IConventionForeignKey>)
Called after a foreign key is removed.
public virtual void ProcessForeignKeyRemoved(IConventionEntityTypeBuilder entityTypeBuilder, IConventionForeignKey foreignKey, IConventionContext<IConventionForeignKey> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
foreignKey
IConventionForeignKeyThe removed foreign key.
context
IConventionContext<IConventionForeignKey>Additional information associated with convention execution.