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
)
参数
- context
类型:System.Data.Services.Client.DataServiceContext
DataServiceContext 用于跟踪对集合中对象所做的更改。
注释
使用此构造函数可创建空 DataServiceCollection<T>,在未对服务执行查询或 IEnumerable<T> 不可用时也可向其添加实体对象。
默认情况下,将对 DataServiceCollection<T> 启用自动更改跟踪。 您可以创建 DataServiceCollection<T> 的实例,该实例在您使用可以为 TrackingMode 提供 None 值的构造函数创建实例时,会使用手动更改跟踪。 使用手动跟踪时,必须实现 INotifyPropertyChanged 和 INotifyCollectionChanged 并处理引发事件,以便将更改手动报告到 DataServiceContext。