Share via


DataServiceContext Constructor

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

Initializes a new instance of the DataServiceContext class by using the specified baseURI.

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

Syntax

'Declaration
Public Sub New ( _
    serviceRoot As Uri _
)
public DataServiceContext(
    Uri serviceRoot
)

Parameters

  • serviceRoot
    Type: System.Uri
    An absolute URI that identifies the root of a data service.

Exceptions

Exception Condition
ArgumentNullException

When serviceRoot is nulla null reference (Nothing in Visual Basic) (Nothing in Visual Basic).

ArgumentException

When serviceRoot is not an absolute, well-formed URI, does not begin with http or https, or contains a query or query fragment.

Remarks

The client library expects the baseURI to point to the root of a data service, but it does not issue a request to validate it. If the baseURI does not determine the root of the service, the behavior of the client library is undefined.

When run within Silverlight, a relative path may be used for baseUri. In this case, the path is relative to the authority (scheme + host + port) section of the URI for the page hosting the Silverlight control.

A URI with a trailing slash is the same as one without the trailing character.

Examples

For examples that use DataServiceContext, see 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.