如何处理SOA中的数据更改跟踪 [英] How do I handle data change tracking in SOA

查看:93
本文介绍了如何处理SOA中的数据更改跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我工作的地方,我们决定使用rest服务将数据返回给客户端。目前这只是.NET客户端(WPF和ASP.NET),但将来可能是第三方希望使用的任何东西。



抛出的问题是如何处理数据的更改跟踪。因此,您调用以获取员工实体(可能有许多子项)更改一个数据并在传递已更改实体的服务上调用更新方法。服务如何知道更改的内容以执行更新?目前的想法是,您要么更新与模型相关的所有记录,要么在实体上为更改状态提供属性,并让客户负责通知哪些对象已更改。这两者似乎都不是理想的解决方案。



肯定有人在我们面前解决了这个问题....



更多信息:



例如,如果您有一个返回的员工对象有很多SalaryPayments,如果其中一个工资支付被更改,我就不会想要更新所有这些。

Where I work it has been decided that we are going to use rest services to return data to clients. Currently this is just .NET Clients (WPF and ASP.NET) but in the future could be anything a 3rd party wishes to use.

The issue being thrown about is how you handle change tracking of the data. So you make a call to get an employee entity (which may have many children) change one piece of data and call an update method on the service passing the changed entity. How does the service know what has changed to perform the update? Current thinking is you either update all records related to the model or provide a property on the entity for 'change status' and let the client be responsible for notifying what object has changed. Neither of which seems the ideal solution.

Surely someone else has solved this issue before us....

more info:

For example if you have an employee object returned which has lots of 'SalaryPayments', if one of the salary payments was changed I would not want to update all of them.

推荐答案

为什么服务需要知道改变了什么?举一个你在这里想的例子。



它通常只是将整个记录写回数据库而不知道改变了什么。它假定一切都已改变,当然除了记录ID。
Why would the service need to know what has changed? Give an example of what you're thinking here.

It normally just writes the entire record back to the database without having a clue about what changed. It assumes everything has changed, except the record ID of course.


这篇关于如何处理SOA中的数据更改跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆