Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COI don't understand how doing this in the DB is the only multi-user-safe option. My repositories operate using a UnitOfWork pattern which wraps an ObjectContext with EntityTransaction. I'd like to avoid db-level validation because 1) it makes this requirement less testable, 2) it involves catching a SQLException, and 3) there is no way to invoke the validator from the client without hitting the database.
      singulars
    2. CO@olivehour, only the DB can see outside of its own transaction. A unique constraint on the DB *will not fail, period,* even if the conflicting, committed record is in a transaction not visible to yours. Doing it in the app server means that the following is possible: 1) User A checks for conflicts, finds none, 2) User B checks for conflicts, finds none, 3) User A commits "Bob" as a name, 4) User "B" commits "Bob" as a name. Oops. You don't need to test features built in to your DB server; that's not your code. You *can* validate this from the client, though.
      singulars
    3. COOK, so you're talking about concurrency. I have a timestamp column in the db table, and the app will check the row version before doing any commits (optimistic concurrency implementation). When User B commits "Bob", the timestamp values won't match and the app will know there is a concurrency conflict. I can't put a unique constraint on the column in question, because the DB also has an IsCurrentVersion column. All old rows are kept in the database. So, there can be many users in the DB with the same UserID, but only one will have IsCurrentVersion == true. A trigger would be needed instead.
      singulars
 

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