private void Store(GifAtMeContext stContext) { if (HttpContext.Current.Items.Contains(_dataContextKey)) { HttpContext.Current.Items[_dataContextKey] = stContext; } else { HttpContext.Current.Items.Add(_dataContextKey, stContext); } }
public GenericDomainTypeRepository(IUnitOfWork unitOfWork, IGifAtMeContextFactory contextFactory) { if (unitOfWork == null) { throw new ArgumentNullException("Unit of work"); } _unitOfWork = unitOfWork; if (contextFactory == null) { throw new ArgumentNullException("DbContextFactory"); } _context = contextFactory.Create(); }
public GifAtMeContext Create() { GifAtMeContext stContext = null; if (HttpContext.Current.Items.Contains(_dataContextKey)) { stContext = HttpContext.Current.Items[_dataContextKey] as GifAtMeContext; } else { stContext = new GifAtMeContext(); Store(stContext); } return(stContext); }