Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In figure 1 we have committed "Sigmund Freud" (1.) to the domain
object, as can be seen in the debugger (3.). We are about to
change the FirstName to "Arnold":

Image Added

In figure 2 we have written "Arnold" into Dr. Freud's
FirstName (1.), what can be seen in the debugger (3.). We are
about to roll that name change back (2.):

Image Added

In figure 3 we Rollback() has done its thing (1.) and has
restored Freud's FirstName (2.) by reloading the data that was
committed before – "Sigmund":

Image Added

Now let's see the contrast to Discard(). In figure 3 above,
we are about to discard the entire transaction. What will
we get if discard the transaction and try to display Freud's
first name with Console.WriteLine()? (Next line.) The answer
is this:

Image Added

This is a very helpful exception. It tells you exactly what the
problem is: "The transaction can no longer be used because it has been
discarded."

...