Given optimistic concurrency using a version property and a json rest-service with a client that returns changesets consisting of the Id, Version and changed properties only, how can I update my server-side entity?
我想要做的是,将我的json推为一个精干的实体,然后使用ISession。 更新实体的方法。 然而,我的附属实体对许多财产将无价值,如果我称之为“合并”的话,我的实体将更新所有这些财产,这不是我想要的东西。 如果有办法说明合并,忽视那些无效的财产,并保留将解决我的问题的持久性实体的任何相应的非核价值。
If there is no way to configure the behaviour for merge, I could of course get the persisted entity and implement my own merging method using reflection. The problem with this approach is that it requires that I first query the db for the entity and then update it, whereas the merge method should do this as one operation unless I am mistaken.
你可能会问,为什么我只想通过改动,而不是完整的实体。 这是因为,它使我能够发送最低限度的数据,它还明确表明用户正在努力改变的情况,我可以用来测试用户的权利。
如果无法在祖国的界限内做到这一点,你将如何行事?