Exemplo n.º 1
0
        public CacheController(ILoggerFactory loggerFactory, ICachingRepository cachingRepository)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _logger = loggerFactory.CreateLogger <CacheController>();

            _cachingRepository = cachingRepository ?? throw new ArgumentNullException(nameof(cachingRepository));

            _logger.LogInformation("Контроллер инициализирован.");
        }
Exemplo n.º 2
0
        public LazyLoaderController(ICachingRepository cachingRepository)
        {
            StockPriceLists = new Lazy <CacheDictionary <int, StockPricelists> >(() =>
            {
                return(CacheDictionary <int, StockPricelists>
                       .CreateDictionary(cachingRepository.GetAllStockPriceLists(), (v) => v.Id, (v) => v));
            });

            StockItemGroups = new Lazy <CacheDictionary <int, StockItemGroups> >(() =>

            {
                return(CacheDictionary <int, StockItemGroups>
                       .CreateDictionary(cachingRepository.GetAllStockItemGroups(), (v) => v.Id, (v) => v));
            });

            CatalogueItems = new Lazy <CacheDictionary <string, stCatalogue> >(() =>
            {
                return(CacheDictionary <string, stCatalogue>
                       .CreateDictionary(cachingRepository.stLoadCatalogue(), (v) => v.ItemCode, (v) => v));
            });

            InventoryPricing = new Lazy <CacheDictionary <string, List <stInventoryPricing> > >(() =>
            {
                var inventoryPricings = cachingRepository.stGetInventoryPricing();

                var values =
                    inventoryPricings
                    .GroupBy(g => new { g.ItemCode })
                    .ToDictionary(d => d.Key.ItemCode, d => d.ToList());

                return(CacheDictionary <string, List <stInventoryPricing> > .CreateDictionary(values));
            });

            StockSets = new Lazy <IEnumerable <StockSets> >(() =>
            {
                return(cachingRepository.GetAllStockSets()
                       .Where(w => (w.Flags & (int)StockSetFlags.Disabled) == 0)
                       .ToList());
            });

            StockEmbroideryPricing = new Lazy <IEnumerable <StockEmbroideryPricing> >(() => cachingRepository.GetAllStockEmbroideryPricing());

            _cachingRepository = cachingRepository;
        }
 public ModulesControllerTests(ITestOutputHelper output) : base(output)
 {
     _cachingRepository = ServiceProvider.GetService <ICachingRepository>();
     _controller        = new ModulesController(LoggerFactory, _cachingRepository);
 }
Exemplo n.º 4
0
 public AdminUserController(ICacheService cacheService,
     ICachingRepository<User, int> userRepository)
 {
     this.cacheService = cacheService;
     this.userRepository = userRepository;
 }
Exemplo n.º 5
0
 public CachingService(ICachingRepository cachingRepository)
     : base(cachingRepository)
 {
     lazyLoaderController = new LazyLoaderController(cachingRepository);
 }
Exemplo n.º 6
0
 public ProductRepository(ProductContext context, ICachingRepository cachingRepository)
 {
     _context           = context;
     _cachingRepository = cachingRepository;
 }
Exemplo n.º 7
0
 public ManufacturerRepository(ProductContext context, ICachingRepository cachingRepository)
 {
     _context           = context;
     _cachingRepository = cachingRepository;
 }
Exemplo n.º 8
0
 public static AccountCacheController Instance(ICachingRepository cachingRepository, LazyLoaderController lazyLoaderController)
 => new AccountCacheController(cachingRepository, lazyLoaderController);
Exemplo n.º 9
0
 public AccountCacheController(ICachingRepository cachingRepository, LazyLoaderController lazyLoaderController)
 {
     _cachingRepository        = cachingRepository;
     this.lazyLoaderController = lazyLoaderController;
 }
Exemplo n.º 10
0
 public static InventoryCacheController Instance(ICachingRepository cachingRepository, LazyLoaderController lazyLoaderController)
 => new InventoryCacheController(cachingRepository, lazyLoaderController);
Exemplo n.º 11
0
 public InventoryCacheController(ICachingRepository cachingRepository,
                                 LazyLoaderController lazyLoaderController)
 {
     _cachingRepository    = cachingRepository;
     _lazyLoaderController = lazyLoaderController;
 }
Exemplo n.º 12
0
 public BaseCachingService(ICachingRepository cachingRepository)
 {
     this.cachingRepository = cachingRepository;
 }