Share via


DataServiceCollection<T> 构造函数 (DataServiceContext)

创建 DataServiceCollection<T> 类的新实例,该实例使用指定的 DataServiceContext

命名空间:  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> 启用自动更改跟踪。 您可以创建 DataServiceCollection<T> 的实例,该实例在您使用可以为 TrackingMode 提供 None 值的构造函数创建实例时,会使用手动更改跟踪。 使用手动跟踪时,必须实现 INotifyPropertyChangedINotifyCollectionChanged 并处理引发事件,以便将更改手动报告到 DataServiceContext

请参阅

参考

DataServiceCollection<T> 类

DataServiceCollection<T> 重载

System.Data.Services.Client 命名空间