Partager via


DataServiceContext.BeginLoadProperty Method (Object, String, AsyncCallback, Object)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Begins the operation to load the value of the specified property from the data service.

Namespace:  System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

Syntax

'Declaration
Public Function BeginLoadProperty ( _
    entity As Object, _
    propertyName As String, _
    callback As AsyncCallback, _
    state As Object _
) As IAsyncResult
public IAsyncResult BeginLoadProperty(
    Object entity,
    string propertyName,
    AsyncCallback callback,
    Object state
)

Parameters

  • entity
    Type: System.Object
    The entity that contains the property to load.
  • propertyName
    Type: System.String
    The name of the property on the specified entity to load.
  • callback
    Type: System.AsyncCallback
    The delegate called when a response to the request is received.
  • state
    Type: System.Object
    The user-defined state object used to pass context data to the callback method.

Return Value

Type: System.IAsyncResult
An IAsyncResult that represents the status of the asynchronous operation.

Remarks

Calling this method invokes a network operation to retrieve the value of a property. The property that is specified may be any of the properties on an entity, including properties that represent associations or links. If the property represents an association, link, or a deferred property, calling this method provides the client with a way to lazily load related resources. If the entity is in the modified state, the property value loads related entities and marks them and any links as unchanged.

If the property is already loaded, calling this method lets you update the value of the property.

You must use the BeginInvoke method of the Dispatcher class to correctly marshal the response operation back to the main application thread (the UI thread) of your Silverlight-based application. For more information, see Synchronizing Data for Multithreading.

Examples

For an example that uses the BeginLoadProperty method, see Loading Related Entities (WCF Data Services/Silverlight).

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.