ConventionAnnotatableExtensions.SetOrRemoveAnnotation 方法

定义

设置存储在给定名称下的批注。 如果具有指定名称的注释已存在,则覆盖现有批注。 如果 null 提供,则删除现有批注。

public static void SetOrRemoveAnnotation (this Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable annotatable, string name, object value, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotation SetOrRemoveAnnotation (this Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable annotatable, string name, object value, bool fromDataAnnotation = false);
static member SetOrRemoveAnnotation : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable * string * obj * bool -> unit
static member SetOrRemoveAnnotation : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable * string * obj * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotation
<Extension()>
Public Sub SetOrRemoveAnnotation (annotatable As IConventionAnnotatable, name As String, value As Object, Optional fromDataAnnotation As Boolean = false)
<Extension()>
Public Function SetOrRemoveAnnotation (annotatable As IConventionAnnotatable, name As String, value As Object, Optional fromDataAnnotation As Boolean = false) As IConventionAnnotation

参数

annotatable
IConventionAnnotatable

要为其设置批注的对象。

name
String

要添加的批注的名称。

value
Object

要存储在批注中的值。

fromDataAnnotation
Boolean

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

返回

新批注或 null (如果已删除)。

适用于