构建数据录入表单与应用安全保障
1. 数据冲突处理与提交
在处理数据时,可能会遇到冲突。可以自动处理这些冲突(如果需要),还能从 conflictinfo.PropertyNames 属性获取值已更改的属性名称。若要强制使用当前用户的版本覆盖服务器上的版本,可使用如下代码:
// Handle any conflicts automatically (if you wish)
// You can get the names of the properties whose value has changed
// from the conflictinfo.PropertyNames property
// Force this user's version to overwrite the version on the server
product.EntityConflict.Resolve();
解决更改后,记得将其重新提交回服务器。另外,除了手动处理冲突,还可以参考 Sergey Klementiev 创建的通过 RIA 服务处理并发错误的通用方法,相关博客链接为: http://sklementiev.blogspot.com/2010/03/wcf-ria-and-concurrency.html 。
超级会员免费看
订阅专栏 解锁全文
4272

被折叠的 条评论
为什么被折叠?



