DbSet<TEntity>.IListSource.GetList 方法

定義

嘗試將資料系結直接系結至 DbSet<TEntity> 時,資料系結架構會呼叫這個方法。

System.Collections.IList IListSource.GetList ();
abstract member System.ComponentModel.IListSource.GetList : unit -> System.Collections.IList
override this.System.ComponentModel.IListSource.GetList : unit -> System.Collections.IList
Function GetList () As IList Implements IListSource.GetList

傳回

永不傳回,一律會擲回例外狀況。

實作

例外狀況

一律擲回。

備註

這個實作一律會擲回例外狀況,因為系結至 DbSet<TEntity> ,會導致每次資料系結架構要求集合內容時,將查詢傳送至資料庫。 相反地,使用 Load<TSource>(IQueryable<TSource>) 擴充方法將結果載入內容中,然後透過 Local 呼叫 ToObservableCollection() WPF 系結或 ToBindingList() WinForms,系結至 本機資料。

如需詳細資訊和範例,請參閱 EF Core 中追蹤實體的本機檢視

適用於