建完一个Silverlight+riaservice项目之后,在web端的domainservice类只会产生如下代码:
public void UpdateAbsentRecord(AbsentRecord currentAbsentRecord)
{
this.Context.AttachAsModified(currentAbsentRecord, this.ChangeSet.GetOriginal(currentAbsentRecord));
}
类似于这种的类的修改方法,不知在客户端是如何调用到的,怎么也试不出如何使用,请大家帮帮忙!
因为不是用DataGrid直接进行修改,我是从数据库拿到一个类,对类修改后,
HRMSDomainContext domainContext = new HRMSDomainContext();
domainContext.SubmitChanges();
无法修改到数据库。
((IEditableObject)newEmployee).BeginEdit();
newEmployee.Age = 60;
((IEditableObject)newEmployee).EndEdit();
domainContext.SubmitChanges();
也是一样,只能改到类的数据,无法保存到数据库。因为我只是传了一个类的数据到某个Page,没有用到控件,所以无法用到load方法。
现在只是用了
domainContext.Employees.Add(theEmployee);
domainContext.Employees.Remove(theEmployee);
对表进行增加和删除,对于[update]属性的定义还不会使用,riaoverview中也没提到
不是用控件的,所以除了load方法还有没有其他方法可以使用?
请各位朋友帮帮忙
http://funsl.com/content/silverlight3%E7%AB%AF%E6%93%8D%E4%BD%9C%E6%95%B...
以上包括了,add ,remove,edit操作
因为不是用DataGrid直接进行修改,我是从数据库拿到一个类,对类修改后,
你的例子中仅是对DATAGRID操作啊,
假定你的表里有一个id字段,我现在要改第一条数据的id为100:
1.异步取得数据.getquery操作
2.修改:
domainContext.Employees.first().id=100;
domainContext.subchange();
以上操作即可