public static long Generate()
        {
            try
            {
                _uoWork     = new PlugUoWork(/*You can specify you custom context here*/);
                _repository = new PlugRepository <SerialNumberKeeper>(_uoWork);

                Purge();

                var processedScratchPin = _repository.Add(new SerialNumberKeeper());
                _uoWork.SaveChanges();
                return(processedScratchPin.SerialNumberKeeperId);
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.GetBaseException().Message);
                return(0);
            }
        }
 public SerialNumberKeeperRepository()
 {
     _uoWork     = new PlugUoWork(/*You can specify you custom context here*/);
     _repository = new PlugRepository <SerialNumberKeeper>(_uoWork);
 }
Exemplo n.º 3
0
 public PlugRepository(IPlugUoWork uoWork)
 {
     _context   = uoWork ?? throw new ArgumentNullException(nameof(uoWork));
     _dbSet     = uoWork.Context.PlugDbContext.Set <T>();
     _dbContext = uoWork.Context.PlugDbContext;
 }