Example #1
0
        public UnitOfWork(cEditorContext dbContext, IRepository repository)
        {
            if (dbContext == null) throw new ArgumentNullException(nameof(dbContext));
            if (repository == null) throw new ArgumentNullException(nameof(repository));

            _dbContext = dbContext;
            _repository = repository;
        }
Example #2
0
        public IUnitOfWork Create()
        {
            try
            {
                var dbContext = new cEditorContext(_connectionStringProvider.GetConnectionString,
                SystemConst.AssemblyConvention);
                var repository = new Repository(dbContext);
                var result = new UnitOfWork(dbContext, repository);

                return result;
            }
            catch (DataException ex)
            {
                throw new DbFatalException(ex);
            }
        }