語言

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 是它被移除了。

適用於