DataServiceCollection<T>.LoadAsync Method (IQueryable<T>)
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Asynchronously loads the collection by executing a DataServiceQuery<TElement>.
Namespace: System.Data.Services.Client
Assembly: System.Data.Services.Client (in System.Data.Services.Client.dll)
Syntax
'Declaration
Public Sub LoadAsync ( _
query As IQueryable(Of T) _
)
public void LoadAsync(
IQueryable<T> query
)
Parameters
- query
Type: System.Linq.IQueryable<T>
The DataServiceQuery<TElement> that, when executed, returns the entities to load into the collection.
Exceptions
Exception | Condition |
---|---|
ArgumentException | When query is nulla null reference (Nothing in Visual Basic) or not a DataServiceQuery<TElement>. |
InvalidOperationException | When a previous call to LoadAsync is not yet complete. |
Remarks
Because the LoadAsync method is asynchronous, the method returns before a response to the data service is received. You must handle the LoadCompleted event to access the QueryOperationResponse<T> that contains information about the result of the load operation. Items are loaded into the collection when the load operation is complete, whether or not the LoadCompleted event is handled.
The LoadAsync method can be called only once on the UI thread. The method cannot be called again until after the LoadCompleted event is raised. The LoadCompleted event is raised whether or not the query succeeds.
Version Information
Silverlight
Supported in: 5, 4
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.