Sys.Data.AdoNetServiceProxy Class
Provides methods and properties for interacting with ADO.NET data services.
Namespace: Sys.Data
Inherits: None.
var a = new Sys.Data.AdoNetServiceProxy(serviceUri);
Public Constructors
Name |
Description |
---|---|
Creates a new instance of the AdoNetServiceProxy class. |
Members
Member |
Description |
---|---|
Creates an ordered set of operations to execute against by using the data service. |
|
Retrieves data from the provided service URI. |
|
Loads data for a property that was not included with the data returned by a retrieval operation. |
|
Adds a new record by using the data service. |
|
Executes a method of the data service. |
|
Retrieves data from the data service. |
|
Deletes an existing record by using the data service. |
|
Modifies an existing record by using the data service. |
|
Gets the path of the ADO.NET Data Service. |
|
Gets or sets a value that indicates whether original values are replaced. |
|
Gets sets the URI of the data service to interact with. |
Remarks
The AdoNetServiceProxy class provides functions that you can call in order to interact with a data service from an ASP.NET AJAX application. By using this class, you can create Web applications that interact with data from the Web site and that can update the Web page without a full postback to the Web server.
When you create an instance of the AdoNetServiceProxy class, you provide the relative URI of the data service that contains the data that you want to retrieve, as shown in the following example:
var exampleService =
new Sys.Data.AdoNetServiceProxy("/northwind.svc");
After you create an instance of the AdoNetServiceProxy class, you can set properties of the class that are used as the default properties in all data operations. These properties include the following:
Sys.Data.AdoNetServiceProxy.path Property
Sys.Data.AdoNetServiceProxy.replaceOnUpdate Property
Sys.Data.AdoNetServiceProxy.serviceUri Property
The defaultSucceededCallback and defaultFailedCallback properties contain the names of the functions that will be called after the data operation has succeeded or failed. The defaultUserContext property contains the context information that is passed as a parameter to the callback functions, unless you provide a different user context when you call a data operation.
The insert, query, remove, and update methods enable you to perform a single operation. The createActionSequence method enables you to create an AdoNetActionSequence object and add operations to a queue that are executed as a batch. The invoke method enables you to execute a method of the data service. The populateDeferredProperty method enables you to load data from a property that was not retrieved in the original data request because the property contains a large amount of data.
For an example that demonstrates this type, see Walkthrough: Using a Data Service in an AJAX Application.
Example
The following example shows how to imperatively instantiate a AdoNetServiceProxy class and bind to a DataView object.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<title>DataView with ADO.NET data service</title>
<link href="styles/list.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../MicrosoftAjax/MicrosoftAjax.debug.js"></script>
<script type="text/javascript" src="../MicrosoftAjax/MicrosoftAjaxTemplates.debug.js"></script>
<script type="text/javascript" src="../MicrosoftAjax/MicrosoftAjaxAdoNet.debug.js"></script>
</head>
<body xmlns:dataview="javascript:Sys.UI.DataView" xmlns:sys="javascript:Sys">
<ul class="list sys-template"
sys:attach="dataview"
dataview:autofetch="true"
dataview:dataprovider="{{ new Sys.Data.AdoNetServiceProxy('../Services/ImagesDataService.svc') }}"
dataview:fetchoperation="Images"
dataview:fetchparameters="{{ {$orderby: 'Name'} }}"
>
<li>
<span>{{ Name }}</span>
<span class="value">{{ Description }}</span>
</li>
</ul>
</body>
</html>