DataServiceCollection<T> 构造函数 (IEnumerable<T>, TrackingMode)
创建基于查询执行并使用指定跟踪模式的 DataServiceCollection<T> 类的新实例。
命名空间: System.Data.Services.Client
程序集: Microsoft.Data.Services.Client(在 Microsoft.Data.Services.Client.dll 中)
语法
声明
Public Sub New ( _
items As IEnumerable(Of T), _
trackingMode As TrackingMode _
)
用法
Dim items As IEnumerable(Of T)
Dim trackingMode As TrackingMode
Dim instance As New DataServiceCollection(items, trackingMode)
public DataServiceCollection(
IEnumerable<T> items,
TrackingMode trackingMode
)
public:
DataServiceCollection(
IEnumerable<T>^ items,
TrackingMode trackingMode
)
new :
items:IEnumerable<'T> *
trackingMode:TrackingMode -> DataServiceCollection
public function DataServiceCollection(
items : IEnumerable<T>,
trackingMode : TrackingMode
)
参数
- items
类型:System.Collections.Generic.IEnumerable<T>
DataServiceQuery<TElement> 或 LINQ 查询,可返回用于初始化集合的对象的 IEnumerable<T> 集合。
- trackingMode
类型:System.Data.Services.Client.TrackingMode
TrackingMode 值,用于指示是否自动跟踪对集合中各项所做的更改。
注释
默认情况下,将对 DataServiceCollection<T> 启用自动更改跟踪。 使用此类构造函数并为 trackingMode 提供 None 值,以便创建使用手动更改跟踪的 DataServiceCollection<T> 实例。 使用手动跟踪时,必须实现 INotifyPropertyChanged 和 INotifyCollectionChanged 并处理引发事件,以便将更改手动报告到 DataServiceContext。
为 items 提供的对象的 IEnumerable<T> 集合通常是可一个返回集合中各项的查询。 不过,可以提供正确类型的任何 IEnumerable<T> 集合。