public Task <IUnitOfWork> CreateAsync()
        {
            // If there's an existing, undisposed unit of work, we're trying to nest units of work. Not supported.
            if (ActiveUnitOfWorkExists())
            {
                throw new Exception(
                          "Cannot create unit of work: A unit of work was created before the previous unit of work was complete.");
            }

            var dbContext = _serviceProvider.GetRequiredService <TDbContext>();

            _unitOfWork = new EntityFrameworkUnitOfWork <TDbContext>(dbContext);
            return(Task.FromResult <IUnitOfWork>(_unitOfWork));
        }
Example #2
0
 public EFRepositoryWithIntegerIdEntity(IEntityFrameworkUnitOfWork unitOfWork) : this(unitOfWork.Context)
 {
     _unitOfWork = unitOfWork;
 }
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="unitofwork">Unidad de trabajo</param>
 public Repositorio(IEntityFrameworkUnitOfWork unitofwork)
 {
     this.unitofwork = unitofwork;
 }
Example #4
0
 public BaseEFRepository(IEntityFrameworkUnitOfWork unitOfWork) : this(unitOfWork.Context)
 {
     _unitOfWork = unitOfWork;
 }