ConventionPropertyBaseExtensions.SetField 方法

定義

設定此屬性應該使用的基礎 CLR 欄位。 這可能 null 適用于陰影屬性,或如果不知道屬性的備份欄位。

備份欄位通常依照慣例找到,如下所述: http://go.microsoft.com/fwlink/?LinkId=723277. 此方法適用于在慣例找不到正確欄位的情況下明確設定支援欄位。

根據預設,如果找到或已指定支援欄位,則會在建構新物件時使用,通常是從資料庫查詢實體時。 屬性會用於所有其他存取。 呼叫 即可變更此專案 SetPropertyAccessMode(IConventionPropertyBase, Nullable<PropertyAccessMode>, Boolean)

public static void SetField (this Microsoft.EntityFrameworkCore.Metadata.IConventionPropertyBase property, string fieldName, bool fromDataAnnotation = false);
static member SetField : Microsoft.EntityFrameworkCore.Metadata.IConventionPropertyBase * string * bool -> unit
<Extension()>
Public Sub SetField (property As IConventionPropertyBase, fieldName As String, Optional fromDataAnnotation As Boolean = false)

參數

property
IConventionPropertyBase

應設定支援欄位的屬性。

fieldName
String

要使用的功能變數名稱。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

適用於