使用 jQuery 和 OData(WCF 数据服务)更新/插入多行
我有三个表:Template、Fields 和 TemplateFields。 TemplateFields 保存每个模板的选定字段。 当用户完成选择字段时,我需要更新 TemplateFields。我能想到的唯一方法是删除该模板的所有 TemplateField,然后在单独的请求中将它们一一添加。这真的很糟糕,因为没有事务可以回退,而且还会有很多请求。
有没有办法使用 WCF 数据服务一次添加多个“对象”?然后我可以使用拦截器来更新数据库。
I have three tables, Template, Fields and TemplateFields. TemplateFields holds the selected fields for each template.
I need to update TemplateFields when the user is finished selecting the fields. The only way I can see to do this is by deleting all the TemplateFields for that Template and then add them one by one in separate requests. This is really bad because there is not transaction to fall back onto and there will also be MANY requests.
Is there a way of adding multiple 'objects' at once using WCF Data Services? I can then use an Interceptor to update the database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅这篇文章“向 OData/Wcf 数据服务批量添加/创建数据说明”:
http://franssenden.wordpress.com/2010/06/18/addingcreating-data-to-odatawcf-data-service -batch-explained/更新:
文章已移至:
http://www .fcodings.com/2010/06/18/addingcreating-data-to-odatawcf-data-service-batch-explained/
根据评论中的请求引用帖子
服务
客户端
以下是客户端代码中最重要的部分:
See this article "Adding/Creating data to OData/Wcf Data Service batch explained":
http://franssenden.wordpress.com/2010/06/18/addingcreating-data-to-odatawcf-data-service-batch-explained/Update:
The article has moved to:
http://www.fcodings.com/2010/06/18/addingcreating-data-to-odatawcf-data-service-batch-explained/
Quoting from the post as per request in comments
Service
Client
Where the following is the most important piece in the client code: