語言

IConventionPropertyBase 介面

定義

流覽和純量屬性的基底類型。

public interface IConventionPropertyBase : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IPropertyBase
public interface IConventionPropertyBase : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyPropertyBase
type IConventionPropertyBase = interface
    interface IPropertyBase
    interface IAnnotatable
    interface IConventionAnnotatable
type IConventionPropertyBase = interface
    interface IReadOnlyPropertyBase
    interface IReadOnlyAnnotatable
    interface IConventionAnnotatable
Public Interface IConventionPropertyBase
Implements IConventionAnnotatable, IPropertyBase
Public Interface IConventionPropertyBase
Implements IConventionAnnotatable, IReadOnlyPropertyBase
衍生
實作

備註

此介面會在模型建立期間使用,並允許修改中繼資料。 建置模型之後, IReadOnlyPropertyBase 表示相同中繼資料的唯讀檢視。

如需詳細資訊和範例,請參閱 模型建置慣例 。

屬性

名稱 Description
Builder

取得可用來設定這個物件的產生器。

(繼承來源 IConventionAnnotatable)
ClrType

取得這個類似屬性的物件所保留的值型別。

(繼承來源 IReadOnlyPropertyBase)
DeclaringEntityType
已淘汰.

取得此屬性所屬的實體類型。

(繼承來源 IPropertyBase)
DeclaringType

取得此屬性所屬的型別。

FieldInfo

FieldInfo取得此屬性類似物件之基礎 CLR 欄位的 。 null這可能適用于陰影屬性,或如果不支援欄位則為 。

(繼承來源 IReadOnlyPropertyBase)
IsInModel

指出此物件是否在模型中,亦即尚未從其中移除。

(繼承來源 IConventionAnnotatable)
Item[String]

取得具有指定名稱的注釋值,如果不存在,則傳 null 回 。

(繼承來源 IReadOnlyAnnotatable)
Name

取得這個類似屬性的物件名稱。

(繼承來源 IReadOnlyPropertyBase)
PropertyInfo

PropertyInfo取得此屬性類似物件之基礎 CLR 屬性的 。 這適用于陰影屬性,或者如果直接對應至欄位,則 null 為 。

(繼承來源 IReadOnlyPropertyBase)
Sentinel

取得 sentinel 值,這個值表示未設定這個屬性。

(繼承來源 IReadOnlyPropertyBase)

方法

名稱 Description
AddAnnotation(String, Object, Boolean)

將批註加入至這個物件。 如果具有指定名稱的注釋已經存在,則會擲回 。

(繼承來源 IConventionAnnotatable)
AddAnnotations(IEnumerable<IConventionAnnotation>, Boolean)

將批註加入物件。

(繼承來源 IConventionAnnotatable)
AddRuntimeAnnotation(String, Object)

將執行時間批註加入至這個物件。 如果具有指定名稱的注釋已經存在,則會擲回 。

(繼承來源 IAnnotatable)
AnnotationsToDebugString(Int32)

取得 物件上宣告之所有批註的偵錯字串。

(繼承來源 IReadOnlyAnnotatable)
FindAnnotation(String)

取得具有指定名稱的注釋,如果不存在,則傳 null 回 。

(繼承來源 IReadOnlyAnnotatable)
FindRuntimeAnnotation(String)

取得具有指定名稱的執行時間批註,如果不存在,則傳 null 回 。

(繼承來源 IAnnotatable)
FindRuntimeAnnotationValue(String)

取得具有指定名稱的執行時間批註值,如果不存在,則傳 null 回 。

(繼承來源 IAnnotatable)
GetAnnotation(String)

取得具有指定名稱的注釋,如果不存在,則會擲回。

(繼承來源 IReadOnlyAnnotatable)
GetAnnotations()

取得目前 物件上的所有批註。

(繼承來源 IReadOnlyAnnotatable)
GetConfigurationSource()

傳回這個屬性的組態來源。

GetCurrentValueComparer()

IComparer<T>取得 ,用於比較追蹤 IUpdateEntry 專案中的值。

(繼承來源 IPropertyBase)
GetFieldInfoConfigurationSource()

傳回 的 FieldInfo 組態來源。

GetFieldName()

取得這個屬性的備份欄位名稱,如果不知道支援欄位,則 null 為 。

(繼承來源 IReadOnlyPropertyBase)
GetGetter()

取得用於 IClrPropertyGetter 讀取此屬性值的 。

(繼承來源 IPropertyBase)
GetIndex()

取得這個屬性的屬性索引。

(繼承來源 IPropertyBase)
GetMemberInfo(Boolean, Boolean)

取得 或 FieldInfo , PropertyInfo 應該用來取得或設定指定屬性的值。

(繼承來源 IPropertyBase)
GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

取得具有指定名稱的執行時間注釋值,如果不存在,請加以新增。

(繼承來源 IAnnotatable)
GetPropertyAccessMode()

PropertyAccessMode取得用於此屬性類似物件的 。

(繼承來源 IReadOnlyPropertyBase)
GetPropertyAccessModeConfigurationSource()

傳回 的 GetPropertyAccessMode() 組態來源。

GetRuntimeAnnotations()

取得目前 物件上的所有執行時間批註。

(繼承來源 IAnnotatable)
IsIndexerProperty()

取得值,指出這個 是否為索引子屬性。 索引子屬性是透過實體類別上的索引子存取的屬性。

(繼承來源 IReadOnlyPropertyBase)
IsShadowProperty()

取得值,指出這個 是否為陰影屬性。 陰影屬性是實體類別中沒有對應屬性的陰影屬性。 屬性的目前值會儲存在 中 ChangeTracker ,而不是儲存在實體類別的實例中。

(繼承來源 IReadOnlyPropertyBase)
RemoveAnnotation(String)

從這個 物件中移除具有指定名稱的批註。

(繼承來源 IConventionAnnotatable)
RemoveRuntimeAnnotation(String)

從這個 物件中移除指定的執行時間批註。

(繼承來源 IAnnotatable)
SetAnnotation(String, Object, Boolean)

設定儲存在指定名稱下的批註。 如果具有指定名稱的注釋已經存在,則覆寫現有的注釋。

(繼承來源 IConventionAnnotatable)
SetField(FieldInfo, Boolean)
已淘汰.

FieldInfo設定此屬性應該使用之基礎 CLR 欄位的 。

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

SetField(String, Boolean)

設定此屬性應該使用的基礎 CLR 欄位。 這可能 null 適用于陰影屬性,或屬性的支援欄位未知。

SetFieldInfo(FieldInfo, Boolean)

FieldInfo設定此屬性應該使用之基礎 CLR 欄位的 。

SetOrRemoveAnnotation(String, Object, Boolean)

設定儲存在指定名稱下的批註。 如果具有指定名稱的注釋已經存在,則覆寫現有的注釋。 如果 null 已提供,則移除現有的批註。

(繼承來源 IConventionAnnotatable)
SetPropertyAccessMode(Nullable<PropertyAccessMode>, Boolean)

PropertyAccessMode設定要用於這個屬性的 。

SetRuntimeAnnotation(String, Object)

設定儲存在指定索引鍵下的執行時間批註。 如果具有指定名稱的注釋已經存在,則覆寫現有的注釋。

(繼承來源 IAnnotatable)

擴充方法

名稱 Description
AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

將批註加入物件。

GetAnnotation(IConventionAnnotatable, String)

取得具有指定名稱的注釋,如果不存在,則會擲回。

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

設定儲存在指定名稱下的批註。 如果具有指定名稱的注釋已經存在,則覆寫現有的注釋。 如果 null 已提供,則移除現有的批註。

GetPropertyAccessModeConfigurationSource(IConventionPropertyBase)

傳回 的 GetPropertyAccessMode() 組態來源。

SetField(IConventionPropertyBase, String, Boolean)

設定此屬性應該使用的基礎 CLR 欄位。 這可能 null 適用于陰影屬性,或屬性的支援欄位未知。

備份欄位通常是依照慣例找到,如下所述: http://go.microsoft.com/fwlink/?LinkId=723277. 如果慣例找不到正確的欄位,這個方法有助於明確設定支援欄位。

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

SetPropertyAccessMode(IConventionPropertyBase, Nullable<PropertyAccessMode>, Boolean)

PropertyAccessMode設定要用於這個屬性的 。

AnnotationsToDebugString(IAnnotatable, Int32)

取得 物件上宣告之所有批註的偵錯字串。

GetAnnotation(IAnnotatable, String)

取得具有指定名稱的注釋,如果不存在,則會擲回。

GetCurrentValueComparer(IPropertyBase)

IComparer<T>取得 ,用於比較追蹤 IUpdateEntry 專案中的值。

GetFieldName(IPropertyBase)

取得這個屬性的備份欄位名稱,如果不知道支援欄位,則 null 為 。

GetGetter(IPropertyBase)

取得用於 IClrPropertyGetter 讀取此屬性值的 。

請注意,因為這類屬性沒有相關聯的 MemberInfo ,所以呼叫陰影屬性 (IsShadowProperty(IPropertyBase)) 這個方法是錯誤的。

GetIndex(IPropertyBase)

取得這個屬性的屬性索引。

GetMemberInfo(IPropertyBase, Boolean, Boolean)

取得 或 FieldInfo , PropertyInfo 應該用來取得或設定指定屬性的值。

請注意,針對陰影屬性呼叫這個方法 () IsShadowProperty(IPropertyBase) 是一個錯誤,因為這類屬性沒有相關聯的 MemberInfo 。

GetPropertyAccessMode(IPropertyBase)

PropertyAccessMode取得用於這個屬性的 。 null 表示正在使用預設屬性存取模式。

IsIndexerProperty(IPropertyBase)

取得值,指出這個 是否為索引子屬性。 索引子屬性是透過實體類別上的索引子存取的屬性。

IsShadowProperty(IPropertyBase)
已淘汰.

取得值,指出這個 是否為陰影屬性。 陰影屬性是實體類別中沒有對應屬性的陰影屬性。 屬性的目前值會儲存在 中 ChangeTracker ,而不是儲存在實體類別的實例中。

適用於