語言

IReadOnlyProperty 介面

定義

代表結構類型的純量性質。

public interface IReadOnlyProperty : Microsoft.EntityFrameworkCore.Metadata.IReadOnlyPropertyBase
type IReadOnlyProperty = interface
    interface IReadOnlyPropertyBase
    interface IReadOnlyAnnotatable
Public Interface IReadOnlyProperty
Implements IReadOnlyPropertyBase
衍生
實作

備註

更多資訊與範例請參閱 建模實體類型與關係 。

屬性

名稱 Description
ClrType

取得這個類屬性物件所持有的值類型。

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

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

DeclaringType

取得這個類性質物件所屬的類型。

(繼承來源 IReadOnlyPropertyBase)
FieldInfo

取得這個類屬性物件底層 CLR 欄位的 。FieldInfo 這可能是 null 為了陰影性質,或是當背景場未知時。

(繼承來源 IReadOnlyPropertyBase)
IsAutoLoaded

會取得一個值,表示當從資料庫查詢實體時,該屬性是否會自動載入。 當設定為 false時,屬性值不會從資料庫讀取,且該屬性會被排除在 UPDATE 語句中,除非明確載入或修改。

IsCollection

會得到一個值,表示該屬性是否為集合。

(繼承來源 IReadOnlyPropertyBase)
IsConcurrencyToken

會獲得一個值,表示該屬性是否被用作並行標記。 當屬性被設定為並行標記時,當該實體類型的實例在更新或刪除時 SaveChanges() ,會檢查資料庫中的值,以確保自從從資料庫檢索後該值沒有改變。 若變更,將拋出例外,且該變更不會套用到資料庫。

IsNullable

得到一個值,表示此性質是否能包含 null。

IsPrimitiveCollection

若一個屬性的元素類型與 CLR 類型中的元素類型相符,則該屬性稱為原始集合。

Item[String]

取得帶有名稱的註解值,若不存在則回 null 傳。

(繼承來源 IReadOnlyAnnotatable)
Name

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

(繼承來源 IReadOnlyPropertyBase)
PropertyInfo

取得該類性質物件底層 CLR 屬性的 。PropertyInfo 這可能是 null 用於陰影屬性,或是直接映射到欄位。

(繼承來源 IReadOnlyPropertyBase)
Sentinel

取得哨兵值,表示此屬性未被設定。

(繼承來源 IReadOnlyPropertyBase)
ValueGenerated

會獲得一個值,指示資料庫何時會產生該屬性的值。 即使該屬性設定由資料庫產生,EF 仍可能嘗試儲存特定值(而非由資料庫產生),當實體被加入並指派值,或該屬性被標記為已修改為現有實體時。 請參閱 GetBeforeSaveBehavior() 及 GetAfterSaveBehavior() 更多資訊與範例。

方法

名稱 Description
AnnotationsToDebugString(Int32)

取得物件上所有宣告註解的除錯字串。

(繼承來源 IReadOnlyAnnotatable)
FindAnnotation(String)

取得帶有名字的註解,若不存在則回 null 傳。

(繼承來源 IReadOnlyAnnotatable)
FindContainingPrimaryKey()

取得使用該屬性的主鍵(包括包含該屬性的複合主鍵)。

FindFirstPrincipal()

若該屬性是外鍵的一部分,則找到該屬性所受約束的第一個主要性質。

FindTypeMapping()

回傳此屬性的型別映射。

GetAfterSaveBehavior()

會取得一個值,表示該屬性在實體儲存到資料庫後是否能被修改。

GetAnnotation(String)

取得帶有名稱的註解,若不存在則拋出。

(繼承來源 IReadOnlyAnnotatable)
GetAnnotations()

取得目前物件的所有註解。

(繼承來源 IReadOnlyAnnotatable)
GetBeforeSaveBehavior()

會取得一個值,表示該屬性是否可以在實體儲存到資料庫前被修改。

GetContainingForeignKeys()

取得所有使用此屬性的外鍵(包括包含此屬性的複合外鍵)。

GetContainingIndexes()

取得所有使用此屬性的索引(包括包含此屬性的複合索引)。

GetContainingKeys()

取得所有使用此屬性的主鍵或備用鍵(包括包含此屬性的複合鍵)。

GetElementType()

得到由此性質所代表的原始集合元素的配置。

GetFieldName()

取得該性質的背地名稱,或 null 若底盤不已知則得出。

(繼承來源 IReadOnlyPropertyBase)
GetJsonValueReaderWriter()

如果沒有設定,則會得到 。JsonValueReaderWriternull

GetKeyValueComparer()

用鍵值來 ValueComparer 使用這個屬性,或者 null 如果沒有設定任何鍵。

GetMaxLength()

取得此屬性允許的最大資料長度。 例如,若性質為 a String ,則這是最大字元數。

GetPrecision()

取得此性質允許的資料精確度。 例如,若性質為 a Decimal ,則為最大數字數。

GetPrincipals()

尋找包含該屬性的清單,若該屬性屬於外鍵,則該屬性受限制。

GetPrincipals<T>()

尋找包含該屬性的清單,若該屬性屬於外鍵,則該屬性受限制。

GetPropertyAccessMode()

被 PropertyAccessMode 用來做這個類似性質的物件。

(繼承來源 IReadOnlyPropertyBase)
GetProviderClrType()

取得屬性值在送給資料庫提供者前會轉換成的類型。

GetProviderValueComparer()

取得 ValueComparer 來取得此屬性的提供者值。

GetScale()

取得此屬性允許的資料規模。 例如,若性質為 a Decimal ,則此為最大小數位數。

GetTypeMapping()

從最終模型回傳給定屬性的 。CoreTypeMapping

GetValueComparer()

如果沒有設定,則會得到 。ValueComparernull

GetValueConverter()

取得這個屬性的自訂 ValueConverter 設定。

GetValueGeneratorFactory()

取得已設定為此屬性產生數值的工廠(如果有的話)。

IsForeignKey()

會獲得一個值,表示該屬性是否被用作外鍵(或複合外鍵的一部分)。

IsIndex()

會得到一個值,表示該屬性是否被用作指數(或是綜合指數的一部分)。

IsIndexerProperty()

會得到一個值,表示這是否屬於索引器屬性。 索引器屬性是指透過實體類別上的索引器存取的屬性。

(繼承來源 IReadOnlyPropertyBase)
IsKey()

會獲得一個值,表示該屬性是否被用作主鍵或備用鍵(或是複合主鍵或備用鍵的一部分)。

IsPrimaryKey()

會獲得一個值,表示此屬性是否被用作主鍵(或複合主鍵的一部分)。

IsShadowProperty()

會得到一個值,表示這是否是影子屬性。 影子屬性是指在實體類別中沒有對應屬性的屬性。 屬性的當前值會儲存在實體 ChangeTracker 類別的實例中,而非儲存在實體類別的實例中。

(繼承來源 IReadOnlyPropertyBase)
IsUnicode()

會得到一個值,表示該屬性是否能持久化 Unicode 字元。

IsUniqueIndex()

會獲得一個值,表示此屬性是否被用作唯一指數(或是唯一綜合指數的一部分)。

ToDebugString(MetadataDebugStringOptions, Int32)

建立給定元資料的可讀表示法。

警告:請勿依賴回傳字串的格式。 它僅設計用於除錯,且可能在不同版本間任意變動。

擴充方法

名稱 Description
FindHiLoSequence(IReadOnlyProperty, StoreObjectIdentifier)

在模型中找到 , ISequence 用於 hi-lo 圖案。

FindHiLoSequence(IReadOnlyProperty)

在模型中找到 , ISequence 用於 hi-lo 圖案。

FindOverrides(IReadOnlyProperty, StoreObjectIdentifier)

回傳特定類資料表儲存物件的屬性面覆寫。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

FindRelationalTypeMapping(IReadOnlyProperty, StoreObjectIdentifier)

在最終模型上回傳給定屬性的 。RelationalTypeMapping

FindRelationalTypeMapping(IReadOnlyProperty)

在最終模型上回傳給定屬性的 。RelationalTypeMapping

FindSequence(IReadOnlyProperty, StoreObjectIdentifier)

在模型中尋找用於關鍵值產生模式的 。ISequence

FindSequence(IReadOnlyProperty)

在模型中尋找用於關鍵值產生模式的 。ISequence

FindSharedStoreObjectRootProperty(IReadOnlyProperty, StoreObjectIdentifier)

找到第一個 IProperty 映射到共享資料表物件中同一欄位的檔案。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

GetCollation(IReadOnlyProperty, StoreObjectIdentifier)

回傳用於該欄位的排序。

GetCollation(IReadOnlyProperty)

回傳用於該欄位的排序。

GetColumnBaseName(IReadOnlyProperty)
已淘汰.

回傳屬性將映射到的欄位的基底名稱。

GetColumnName(IReadOnlyProperty, StoreObjectIdentifier)

回傳該屬性映射到特定資料表的欄位名稱。

GetColumnName(IReadOnlyProperty)

回傳該屬性將映射到的欄位名稱。

GetColumnOrder(IReadOnlyProperty, StoreObjectIdentifier)

回傳該屬性映射到特定資料表的欄位順序。

GetColumnOrder(IReadOnlyProperty)

回傳該屬性所映射的欄位順序。

GetColumnType(IReadOnlyProperty, StoreObjectIdentifier)

回傳該屬性所映射欄位的資料庫類型,或 null 若找不到該資料庫類型,則回傳該欄位。

GetColumnType(IReadOnlyProperty)

回傳該屬性所映射欄位的資料庫類型,或 null 若找不到該資料庫類型,則回傳該欄位。

GetComment(IReadOnlyProperty, StoreObjectIdentifier)

回傳該屬性所映射欄位的註解。

GetComment(IReadOnlyProperty)

回傳該屬性所映射欄位的註解。

GetComputedColumnSql(IReadOnlyProperty, StoreObjectIdentifier)

回傳用作該屬性對應欄位計算值的 SQL 表達式。

GetComputedColumnSql(IReadOnlyProperty)

回傳用作該屬性對應欄位計算值的 SQL 表達式。

GetDefaultColumnBaseName(IReadOnlyProperty)
已淘汰.

回傳屬性將映射到的欄位的預設基底名稱

GetDefaultColumnName(IReadOnlyProperty, StoreObjectIdentifier)

回傳屬性將映射到的預設欄位名稱。

GetDefaultColumnName(IReadOnlyProperty)

回傳屬性將映射到的欄位的預設基底名稱

GetDefaultConstraintName(IReadOnlyProperty, StoreObjectIdentifier)

會取得預設的約束名稱。

GetDefaultConstraintName(IReadOnlyProperty)

會取得預設的約束名稱。

GetDefaultDefaultConstraintName(IReadOnlyProperty, StoreObjectIdentifier)

根據資料表和欄位名稱產生預設的約束名稱。

GetDefaultValue(IReadOnlyProperty, StoreObjectIdentifier)

回傳作為該屬性所映射欄位預設值的物件。

GetDefaultValue(IReadOnlyProperty)

回傳作為該屬性所映射欄位預設值的物件。

GetDefaultValueGenerationStrategy(IReadOnlyProperty)

會回傳該屬性的預設 SqliteValueGenerationStrategy 值。

GetDefaultValueSql(IReadOnlyProperty, StoreObjectIdentifier)

回傳作為該屬性對應欄位預設值的 SQL 運算式。

GetDefaultValueSql(IReadOnlyProperty)

回傳作為該屬性對應欄位預設值的 SQL 運算式。

GetFullTextSearchLanguage(IReadOnlyProperty)

回傳為此屬性定義的全文搜尋語言。

GetHiLoSequenceName(IReadOnlyProperty, StoreObjectIdentifier)

回傳名稱以用於 hi-lo 序列。

GetHiLoSequenceName(IReadOnlyProperty)

回傳名稱以用於 hi-lo 序列。

GetHiLoSequenceSchema(IReadOnlyProperty, StoreObjectIdentifier)

回傳用於 hi-lo 序列的結構。

GetHiLoSequenceSchema(IReadOnlyProperty)

回傳用於 hi-lo 序列的結構。

GetIdentityIncrement(IReadOnlyProperty, StoreObjectIdentifier)

回傳身份遞增。

GetIdentityIncrement(IReadOnlyProperty)

回傳身份遞增。

GetIdentitySeed(IReadOnlyProperty, StoreObjectIdentifier)

回傳身份種子。

GetIdentitySeed(IReadOnlyProperty)

回傳身份種子。

GetIsFullTextSearchEnabled(IReadOnlyProperty)

回傳該屬性是否啟用全文搜尋的值。

GetIsStored(IReadOnlyProperty, StoreObjectIdentifier)

判斷該屬性映射到的計算欄位值是儲存在資料庫中,還是在讀取時計算。

GetIsStored(IReadOnlyProperty)

判斷該屬性映射到的計算欄位值是儲存在資料庫中,還是在讀取時計算。

GetJsonPropertyName(IReadOnlyProperty)

在鎖定 Cosmos 時,回傳該物件所映射的屬性名稱。

GetJsonPropertyName(IReadOnlyProperty)

取得用於映射到 JSON 欄位的實體屬性的 JSON 屬性名稱值。

GetMappedStoreObjects(IReadOnlyProperty, StoreObjectType)

回傳該屬性映射到的類表格儲存物件。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

GetMaxLength(IReadOnlyProperty, StoreObjectIdentifier)

取得此屬性允許的最大資料長度。 例如,若性質為 a String ,則這是最大字元數。

GetOverrides(IReadOnlyProperty)

回傳所有屬性面覆寫。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

GetPrecision(IReadOnlyProperty, StoreObjectIdentifier)

取得此性質允許的資料精確度。 例如,若性質為 a Decimal ,則為最大數字數。

GetRelationalTypeMapping(IReadOnlyProperty)

在最終模型上回傳給定屬性的 。RelationalTypeMapping

GetScale(IReadOnlyProperty, StoreObjectIdentifier)

取得此屬性允許的資料規模。 例如,若性質為 a Decimal ,則此為最大小數位數。

GetSequenceName(IReadOnlyProperty, StoreObjectIdentifier)

回傳名稱用於關鍵值產生序列。

GetSequenceName(IReadOnlyProperty)

回傳名稱用於關鍵值產生序列。

GetSequenceSchema(IReadOnlyProperty, StoreObjectIdentifier)

回傳用於關鍵值產生序列的結構。

GetSequenceSchema(IReadOnlyProperty)

回傳用於關鍵值產生序列的結構。

GetSrid(IReadOnlyProperty, StoreObjectIdentifier)

回傳 SRID,用於建立此屬性欄位。

GetSrid(IReadOnlyProperty)

回傳 SRID,用於建立此屬性欄位。

GetValueGenerationStrategy(IReadOnlyProperty, StoreObjectIdentifier)

將該 SqliteValueGenerationStrategy 物業歸還使用。

GetValueGenerationStrategy(IReadOnlyProperty, StoreObjectIdentifier)

將該 SqlServerValueGenerationStrategy 物業歸還使用。

GetValueGenerationStrategy(IReadOnlyProperty)

將該 SqliteValueGenerationStrategy 物業歸還使用。

GetValueGenerationStrategy(IReadOnlyProperty)

將該 SqlServerValueGenerationStrategy 物業歸還使用。

GetVectorDimensions(IReadOnlyProperty)

回傳此性質中儲存的向量維度。

GetVectorDistanceFunction(IReadOnlyProperty)

回傳此性質中儲存的向量距離函數。

GetVectorType(IReadOnlyProperty)

回傳此性質中儲存的向量定義。

IsColumnNullable(IReadOnlyProperty, StoreObjectIdentifier)

檢查映射到該屬性的欄位在資料庫建立時是否會成為可空。

IsColumnNullable(IReadOnlyProperty)

檢查映射到給定 IProperty 欄位時,在資料庫中建立時是否可為空。

IsFixedLength(IReadOnlyProperty, StoreObjectIdentifier)

回傳一個標誌,指示該屬性是否能僅儲存固定長度的資料,例如字串。

IsFixedLength(IReadOnlyProperty)

回傳一個標誌,指示該屬性是否能僅儲存固定長度的資料,例如字串。

IsHidden(IReadOnlyProperty)

回傳一個值,指示該屬性的欄位是否以 SQL Server HIDDEN 標誌定義,該欄位將該欄位排除在結果之外SELECT *。

IsSparse(IReadOnlyProperty, StoreObjectIdentifier)

回傳一個值,表示該屬性欄位是否為稀疏。

IsSparse(IReadOnlyProperty)

回傳一個值,表示該屬性欄位是否為稀疏。

IsUnicode(IReadOnlyProperty, StoreObjectIdentifier)

會取得一個值,表示該屬性是否能持久化 Unicode 字元。

TryGetDefaultValue(IReadOnlyProperty, Object)

回傳作為該屬性所映射欄位預設值的物件。

TryGetDefaultValue(IReadOnlyProperty, StoreObjectIdentifier, Object)

回傳作為該屬性所映射欄位預設值的物件。

適用於