ConventionPropertyExtensions.SetAfterSaveBehavior 方法

定义

设置一个值,该值指示在实体保存到数据库后是否可以修改此属性。

如果 Throw为 ,则在数据库中存在实体后,如果为此属性分配了新值,则会引发异常。

如果 Ignore为 ,则将忽略对数据库中已存在的实体的属性值所做的任何修改。

public static void SetAfterSaveBehavior (this Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior? afterSaveBehavior, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior? SetAfterSaveBehavior (this Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior? afterSaveBehavior, bool fromDataAnnotation = false);
static member SetAfterSaveBehavior : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * Nullable<Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior> * bool -> unit
static member SetAfterSaveBehavior : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * Nullable<Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior> * bool -> Nullable<Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior>
<Extension()>
Public Sub SetAfterSaveBehavior (property As IConventionProperty, afterSaveBehavior As Nullable(Of PropertySaveBehavior), Optional fromDataAnnotation As Boolean = false)
<Extension()>
Public Function SetAfterSaveBehavior (property As IConventionProperty, afterSaveBehavior As Nullable(Of PropertySaveBehavior), Optional fromDataAnnotation As Boolean = false) As Nullable(Of PropertySaveBehavior)

参数

property
IConventionProperty

属性。

afterSaveBehavior
Nullable<PropertySaveBehavior>

设置一个值,该值指示在实体保存到数据库后是否可以修改此属性。 null 重置为默认值。

fromDataAnnotation
Boolean

指示配置是否是使用数据注释指定的。

返回

配置的值。

适用于