[索引页]
[源码下载]
作者: webabcd
介绍
Silverlight 2.0 调用 ADO.NET Data Services (数据服务)。本文以 northwind 数据库为示例数据库,做一个添加、查询、更新和删除的Demo
在 Silverlight 2.0 中调用数据服务只能使用异步方式调用。另外,数据服务要与 Silverlight 宿主放在相同的域上
System.Data.Services.Client.DataServiceContext - 数据服务上下文
System.Data.Services.Client.DataServiceQuery - 以指定的 URI 语法查询数据服务
Addobject(),UpdateObject(),DeleteObject() - 本别用于添加,更新,删除实体
BeginExecute()/EndExecute(),BeginExecuteBatch()/EndExecuteBatch - 用于执行某一个 DataServiceQuery 查询或批量执行(将一组查询一次性地提交到数据服务)
BeginSaveChanges()/EndSaveChanges() - 用于提交对实体的修改(增,删,改)
BeginLoadproperty()/EndLoadproperty() - 用于加载指定的属性的值,加载导航属性的时候需要用到它
AddLink(),SetLink(),DeleteLink() - 分别为创建连接,Added状态(一对多);创建连接,Added状态(多对一);删除连接,Deleted状态
在线DEMO
http://www.cnblogs.com/webabcd/archive/2008/10/09/1307486.html
示例
1、数据服务
northwindDataService.svc
northwindDataService.svc.cs
[源码下载]
稳扎稳打Silverlight(28) - 2.0通信之调用ADO.NET Data Services(数据服务)
作者: webabcd
介绍
Silverlight 2.0 调用 ADO.NET Data Services (数据服务)。本文以 northwind 数据库为示例数据库,做一个添加、查询、更新和删除的Demo
在 Silverlight 2.0 中调用数据服务只能使用异步方式调用。另外,数据服务要与 Silverlight 宿主放在相同的域上
System.Data.Services.Client.DataServiceContext - 数据服务上下文
System.Data.Services.Client.DataServiceQuery - 以指定的 URI 语法查询数据服务
Addobject(),UpdateObject(),DeleteObject() - 本别用于添加,更新,删除实体
BeginExecute()/EndExecute(),BeginExecuteBatch()/EndExecuteBatch - 用于执行某一个 DataServiceQuery 查询或批量执行(将一组查询一次性地提交到数据服务)
BeginSaveChanges()/EndSaveChanges() - 用于提交对实体的修改(增,删,改)
BeginLoadproperty()/EndLoadproperty() - 用于加载指定的属性的值,加载导航属性的时候需要用到它
AddLink(),SetLink(),DeleteLink() - 分别为创建连接,Added状态(一对多);创建连接,Added状态(多对一);删除连接,Deleted状态
在线DEMO
http://www.cnblogs.com/webabcd/archive/2008/10/09/1307486.html
示例
1、数据服务
northwindDataService.svc
northwindDataService.svc.cs
2、Silverlight 调用数据服务
DataService.xaml