Share via


DataServiceContext Constructors

Definition

Overloads

DataServiceContext()

Initializes a new instance of the DataServiceContext class.

DataServiceContext(Uri)

Initializes a new instance of the DataServiceContext class with the specified serviceRoot.

DataServiceContext(Uri, ODataProtocolVersion)

Initializes a new instance of the DataServiceContext class with the specified serviceRoot and targeting the specific maxProtocolVersion.

DataServiceContext()

Initializes a new instance of the DataServiceContext class.

public DataServiceContext ();
Public Sub New ()

Remarks

It is expected that the BaseUri or ResolveEntitySet properties will be set before using the newly created context.

Applies to

DataServiceContext(Uri)

Initializes a new instance of the DataServiceContext class with the specified serviceRoot.

public DataServiceContext (Uri serviceRoot);
new Microsoft.OData.Client.DataServiceContext : Uri -> Microsoft.OData.Client.DataServiceContext
Public Sub New (serviceRoot As Uri)

Parameters

serviceRoot
Uri

An absolute URI that identifies the root of a data service.

Exceptions

When the serviceRoot is null.

If the serviceRoot is not an absolute URI -or-If the serviceRoot is a well formed URI without a query or query fragment.

Remarks

The library expects the Uri to point to the root of a data service, but does not issue a request to validate it does indeed identify the root of a service. If the Uri does not identify the root of the service, the behavior of the client library is undefined. A Uri provided with a trailing slash is equivalent to one without such a trailing character. With Silverlight, the serviceRoot can be a relative Uri that will be combined with System.Windows.Browser.HtmlPage.Document.DocumentUri.

Applies to

DataServiceContext(Uri, ODataProtocolVersion)

Initializes a new instance of the DataServiceContext class with the specified serviceRoot and targeting the specific maxProtocolVersion.

public DataServiceContext (Uri serviceRoot, Microsoft.OData.Client.ODataProtocolVersion maxProtocolVersion);
new Microsoft.OData.Client.DataServiceContext : Uri * Microsoft.OData.Client.ODataProtocolVersion -> Microsoft.OData.Client.DataServiceContext
Public Sub New (serviceRoot As Uri, maxProtocolVersion As ODataProtocolVersion)

Parameters

serviceRoot
Uri

An absolute URI that identifies the root of a data service.

maxProtocolVersion
ODataProtocolVersion

A ODataProtocolVersion value that is the maximum protocol version that the client understands.

Remarks

The library expects the Uri to point to the root of a data service, but does not issue a request to validate it does indeed identify the root of a service. If the Uri does not identify the root of the service, the behavior of the client library is undefined. A Uri provided with a trailing slash is equivalent to one without such a trailing character. With Silverlight, the serviceRoot can be a relative Uri that will be combined with System.Windows.Browser.HtmlPage.Document.DocumentUri.

Applies to