Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the EFUnitOfWork class.
 /// </summary>
 /// <param name="forceNewContext">When true, clears out any existing data context first.</param>
 public EFUnitOfWork(bool forceNewContext)
 {
     if (forceNewContext)
     {
         DataContextFactory.Clear();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Saves the changes to the underlying DbContext.
 /// </summary>
 /// <param name="resetAfterCommit">When true, clears out the data context afterwards.</param>
 public void Commit(bool resetAfterCommit)
 {
     DataContextFactory.GetDataContext().SaveChanges();
     if (resetAfterCommit)
     {
         DataContextFactory.Clear();
     }
 }
Beispiel #3
0
 /// <summary>
 /// Undoes changes to the current DbContext by removing it from the storage container.
 /// </summary>
 public void Undo()
 {
     DataContextFactory.Clear();
 }