Skip to content

Instantly share code, notes, and snippets.

@scionwest
Created June 15, 2017 15:32
Show Gist options
  • Save scionwest/bad9e70a16c20a40fe33499bfc1ca7d5 to your computer and use it in GitHub Desktop.
Save scionwest/bad9e70a16c20a40fe33499bfc1ca7d5 to your computer and use it in GitHub Desktop.
Unit of WOrk
// Create repositories as part of a unit of work.
using (IUnitOfWork unitOfWork = this.UnitOfWorkFactory.CreateUnitOfWork())
{
IMovieHeaderRepository repo2 = unitOfWork.GetRepository<IMovieHeaderRepository>();
await repo2.Save(this.Movie);
IGenreRepository repo3 = unitOfWork.GetRepository<IGenreRepository>();
foreach(Movie movie in movies)
await repo3.Save(movie.Genre);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment