Share via


DbCollectionEntry<TEntity, TElement> 類別

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

此類別的執行個體會從 DbEntityEntry<TEntity> 的 Collection 方法傳回,並允許在實體的集合導覽屬性上執行類似載入的作業。

繼承階層

System.Object
  System.Data.Entity.Infrastructure.DbMemberEntry<TEntity, ICollection<TElement>>
    System.Data.Entity.Infrastructure.DbCollectionEntry<TEntity, TElement>

命名空間:  System.Data.Entity.Infrastructure
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Public Class DbCollectionEntry(Of TEntity As Class, TElement) _
    Inherits DbMemberEntry(Of TEntity, ICollection(Of TElement))
'用途
Dim instance As DbCollectionEntry(Of TEntity, TElement)
public class DbCollectionEntry<TEntity, TElement> : DbMemberEntry<TEntity, ICollection<TElement>>
where TEntity : class
generic<typename TEntity, typename TElement>
where TEntity : ref class 
public ref class DbCollectionEntry : public DbMemberEntry<TEntity, ICollection<TElement>^>
type DbCollectionEntry<'TEntity, 'TElement when 'TEntity : not struct> =  
    class 
        inherit DbMemberEntry<'TEntity, ICollection<'TElement>>
    end
JScript does not support generic types and methods.

類型參數

  • TEntity
    此屬性所屬之實體的類型。
  • TElement
    實體集合中項目的類型。

DbCollectionEntry<TEntity, TElement> 類型會公開下列成員。

屬性

  名稱 描述
公用屬性 CurrentValue 取得或設定導覽屬性的目前值。目前的值是導覽屬性所參考的實體。 (覆寫 DbMemberEntry<TEntity, TProperty>.CurrentValue。)
公用屬性 EntityEntry 此導覽屬性所屬的 DbEntityEntry<TEntity>。 (覆寫 DbMemberEntry<TEntity, TProperty>.EntityEntry。)
公用屬性 IsLoaded 取得或設定值,指出是否已從資料庫載入此集合的所有實體。
公用屬性 Name 取得屬性名稱。 (覆寫 DbMemberEntry<TEntity, TProperty>.Name。)

靠上

方法

  名稱 描述
公用方法 Equals 指定此物件是否等於指定的物件。 (繼承自 DbMemberEntry<TEntity, TProperty>)。
受保護的方法 Finalize (繼承自 Object)。
公用方法 GetHashCode 取得與此物件相關聯的雜湊碼。 (繼承自 DbMemberEntry<TEntity, TProperty>)。
公用方法 GetType 取得目前執行個體的 Type。 (繼承自 DbMemberEntry<TEntity, TProperty>)。
公用方法 GetValidationErrors 驗證此屬性。 (繼承自 DbMemberEntry<TEntity, TProperty>)。
公用方法 Load 從資料庫載入實體的集合。請注意,已經存在於內容中的實體不會以資料庫中的值覆寫。
公用方法 LoadAsync() 從資料庫非同步載入實體的集合。請注意,已經存在於內容中的實體不會以資料庫中的值覆寫。
公用方法 LoadAsync(CancellationToken) 從資料庫非同步載入實體的集合。請注意,已經存在於內容中的實體不會以資料庫中的值覆寫。
受保護的方法 MemberwiseClone (繼承自 Object)。
公用方法 Query 傳回查詢,這原本是從資料庫載入此集合所使用的查詢。傳回的查詢可以使用 LINQ 加以修改,以便在資料庫中執行篩選或運算,例如在資料庫內計算集合中的實體數目,而不用實際載入這些實體。
公用方法 ToString 傳回 DbMemberEntry<TEntity, TProperty> 的字串表示法。 (繼承自 DbMemberEntry<TEntity, TProperty>)。

靠上

運算子

  名稱 描述
公用運算子靜態成員 Implicit(DbCollectionEntry<TEntity, TElement> to DbCollectionEntry) 針對此物件所表示的導覽屬性傳回非泛型 DbCollectionEntry 類別的新執行個體。

靠上

執行緒安全

這個類型的任何 Public static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。並非所有的執行個體成員都是安全執行緒。

請參閱

參考

System.Data.Entity.Infrastructure 命名空間