SqlServerValueGenerationConvention 类

定义

将存储值生成 OnAdd 配置为作为主键一部分且不属于任何外键的属性的约定,已配置为具有数据库默认值或配置为使用 SqlServerValueGenerationStrategy。 它还将属性 OnAddOrUpdate 配置为计算列。

public class SqlServerValueGenerationConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.RelationalValueGenerationConvention
type SqlServerValueGenerationConvention = class
    inherit RelationalValueGenerationConvention
Public Class SqlServerValueGenerationConvention
Inherits RelationalValueGenerationConvention
继承

注解

有关详细信息和示例,请参阅模型生成约定和使用 EF Core 访问SQL Server和Azure SQL数据库

构造函数

SqlServerValueGenerationConvention(ProviderConventionSetBuilderDependencies, RelationalConventionSetBuilderDependencies)

创建 SqlServerValueGenerationConvention 的新实例。

属性

Dependencies

此服务的依赖项。

(继承自 ValueGenerationConvention)
RelationalDependencies

此服务的关系提供程序特定的依赖项。

(继承自 RelationalValueGenerationConvention)

方法

GetValueGenerated(IConventionProperty)

返回为给定属性设置的存储值生成策略。

GetValueGenerated(IProperty)

返回为给定属性设置的存储值生成策略。

GetValueGenerated(IProperty, StoreObjectIdentifier)

返回为给定属性设置的存储值生成策略。

GetValueGenerated(IReadOnlyProperty, StoreObjectIdentifier)

返回为给定属性设置的存储值生成策略。

MappingStrategyAllowsValueGeneration(IConventionProperty, String)

检查映射策略和属性是否允许按约定生成值。

(继承自 RelationalValueGenerationConvention)
ProcessEntityTypeAnnotationChanged(IConventionEntityTypeBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在实体上更改批注后调用。

ProcessEntityTypeAnnotationChanged(IConventionEntityTypeBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在对实体类型更改批注后调用。

(继承自 RelationalValueGenerationConvention)
ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder, IConventionEntityType, IConventionEntityType, IConventionContext<IConventionEntityType>)

在实体类型的基类型更改后调用。

(继承自 ValueGenerationConvention)
ProcessEntityTypePrimaryKeyChanged(IConventionEntityTypeBuilder, IConventionKey, IConventionKey, IConventionContext<IConventionKey>)

在实体类型的主键更改后调用。

(继承自 ValueGenerationConvention)
ProcessForeignKeyAdded(IConventionForeignKeyBuilder, IConventionContext<IConventionForeignKeyBuilder>)

在将外键添加到实体类型后调用。

(继承自 ValueGenerationConvention)
ProcessForeignKeyAdded(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

在将外键添加到实体类型后调用。

(继承自 ValueGenerationConvention)
ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder, IConventionContext<Nullable<Boolean>>)

在更改外键的所有权值后调用。

(继承自 ValueGenerationConvention)
ProcessForeignKeyPropertiesChanged(IConventionForeignKeyBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IReadOnlyList<IConventionProperty>>)

在更改外键属性或主体键后调用。

(继承自 ValueGenerationConvention)
ProcessForeignKeyPropertiesChanged(IConventionRelationshipBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IConventionRelationshipBuilder>)

在更改外键属性或主体键后调用。

(继承自 ValueGenerationConvention)
ProcessForeignKeyRemoved(IConventionEntityTypeBuilder, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

在删除外键后调用。

(继承自 ValueGenerationConvention)
ProcessPropertyAnnotationChanged(IConventionPropertyBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在属性上更改批注后调用。

适用于