simmotech wrote:
Otis wrote:
Hmm, you're right. There IS a mechanism build in which cuts off these hierarchies (used in the removedentitiestracker). I could check if this is usable here too. The main thing is that the queues contain all the entities which might be saveable. So not only the dirty entities but also the ones which have FK syncs pending (non-dirty entity which refers to new entity. If new entity is saved, the FK in the non-dirty entity gets set and the non-dirty entity is dirty as well, so is also considered a saveable target).
I see your reasoning behind a non-dirty entity still being considered a saveable target due to a pending FK sync. Definitely makes sense when the UnitOfWork is not remoted.
But doesn't remoting change this scenario? ie If the client sends the server a UnitOfWork2 and it is committed there then for our uses at least, we would never send that UnitOfWork2 back to the client so the syncing (and implicitly the transmission) entity is irrelevant.
No, that's not the scenario I'm talking about.
Say you have an entity X which is previously associated (via an FK) to an instance of Y, namely Y1. Now, you change X to be associated with another instance of Y, Y2. Y2 is new. When Y2 is saved, the FK of X to Y2 will get the new PK value (e.g. an identity field) of Y2. This will make X dirty and it has to be saved as well (otherwise you'll lose the FK reference to Y2 in X!).
If X isn't sent to the server, you'll only get Y2 saved, but never get the new FK value for X saved. This isn't something to optimize away, so these entities have to be send over.
If you were able to find a way a stripping out the hierachies, what scenarios would anything contained in the deserialized UnitOfWork2 get remoted back to the client? Even if they were updated and returned, how would those updates be reincorporated back into the client-side entities?
Maybe a feature for v3 then? Gotta keep you on your toes.
Entities which are transported to the server still have their original state at the client (as they're copies), so you've to refetch the graph.