共用方式為


DataServiceCollection<T> 建構函式 (DataServiceContext)

建立使用指定的 DataServiceContextDataServiceCollection<T> 類別的新執行個體。

命名空間:  System.Data.Services.Client
組件:  Microsoft.Data.Services.Client (在 Microsoft.Data.Services.Client.dll 中)

語法

'宣告
Public Sub New ( _
    context As DataServiceContext _
)
'用途
Dim context As DataServiceContext

Dim instance As New DataServiceCollection(context)
public DataServiceCollection(
    DataServiceContext context
)
public:
DataServiceCollection(
    DataServiceContext^ context
)
new : 
        context:DataServiceContext -> DataServiceCollection
public function DataServiceCollection(
    context : DataServiceContext
)

參數

備註

使用此建構函式建立空白 DataServiceCollection<T>,在不對服務執行查詢或沒有可用 IEnumerable<T> 的情況下加入實體物件。

根據預設,DataServiceCollection<T> 已啟用自動變更追蹤。 當您使用建構函式提供 None 值給 TrackingMode 來建立執行個體時,您可以建立使用手動變更追蹤的 DataServiceCollection<T> 執行個體。 當您使用手動追蹤時,您必須實作 INotifyPropertyChangedINotifyCollectionChanged 並處理引發事件,向 DataServiceContext 手動回報變更。

請參閱

參考

DataServiceCollection<T> 類別

DataServiceCollection<T> 多載

System.Data.Services.Client 命名空間