April 2017
Intermediate to advanced
564 pages
24h 7m
English
We implement the Unit of Work (UOW) pattern to avoid multiple calls to the database server on each object change. With Repository, we store the object state on any particular transaction and submit the changes once through the UOW pattern.
The following is the interface of Unit of Work that exposes four methods to begin and end transactions and to save changes:
public interface IUnitOfWork { void BeginTransaction(); void RollbackTransaction(); void CommitTransaction(); void SaveChanges(); }
The next item is the implementation of Unit of Work, which takes the DbFactory instance, and allow methods to begin and end transactions and call the SaveChanges method to push the changes in one call to the database. This ...
Read now
Unlock full access