Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm going to restate your problem to make sure I've understood it.</p> <p>You have a widget which presents a list of entities (the LIST). When you click an item in the LIST, another widget appears which allows the user to edit the entity. When the user has finished editing the entity, their changes are committed to the DB, and should also be reflected in the LIST of entities. Periodically, the system should also fetch changes that other users have made to items in the LIST and update the LIST. </p> <p>If this is correct, I'm going to leave aside any concurrency problems of two users editing the same entity as this does not seem to be your concern, and will focus on how to organise the UI and the Unit of work.</p> <p>You need to separate out the entities in your LIST from your entities being edited by your inspectors. The business process represented by your inspectors are your units of work, one unit for each entity. Your list does not represent a unit of work. It is a stale representation, or point in time, of the combined work of all the previously committed units of work. Your LIST doen't even have to deal with your entities directly, it can hold an ID or any other way for your inspectors to get at the underlying entity from the DB when a user clicks it. Now you will be free to update the list whenever you like as your inspectors don't share instances with it at all. </p> <p>To simulate to your user that when they are editing an entity via an inspector and to make them appear to be bound to the same thing you have two choices.</p> <p>1) list is only bound to committed data in the DB. This is easy, when an inspector flushes local changes back to the database and commits successfully, provide a way for the inspector to tell the list to update itself.</p> <p>2) list is bound to committed data + local un committed data. This is a bit harder, you need to expose methods on your list which allow an inspector to trump data coming back from the Db, and overwrite it with its own local dirty data.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload