Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I am reading this right, then you are thinking about this wrong. The flow should go something like this (pseudo code)</p> <p>User requests data:</p> <pre><code>Open a context Retrieve data Close the context </code></pre> <p>User saves data:</p> <pre><code>Open a context Save the data Close the context </code></pre> <p>Print work entries:</p> <pre><code>Open a context Retrieve the data Close the context Print the data </code></pre> <p>Notice that in all of these, the context is only open as long as it is needed to perform the appropriate database action. If the print occurs before the user saves their changes, then the changes will not be printed since they have not been persisted by the user anyway.</p> <p><strong>NOW</strong>, sometimes there is a valid approach to keeping the context open throughout the lifetime of the application. However, the same rule should still apply. If the user saves the data, then the other context will become aware of it immediately anyway, as it will pull fresh data from the database when asked to print. Again, if the user does not save their changes, then it is not in the database, so it will not be printed. What if we print it and the user decides to discard the changes? If you want to avoid that situation, then you should probably prompt the user that printing will not pick up the unsaved data and allow them to choose if they still want to print or save the data. If you want to allow them to print saved AND unsaved data, then that is a different problem than EF contexts</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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