Beispiel #1
0
 public IndexModel(ILogger <IndexModel> logger, IMemoryCache memoryCache, pwsstoreContext context, IServiceScopeFactory serviceFactory)
 {
     _logger              = logger;
     _memoryCache         = memoryCache;
     _context             = context;
     _serviceScopeFactory = serviceFactory;
 }
Beispiel #2
0
 public pwsController(IMemoryCache memoryCache, pwsstoreContext context, IServiceScopeFactory serviceFactory, Microsoft.Extensions.Configuration.IConfiguration configuration)
 {
     _configuration  = configuration;
     _memoryCache    = memoryCache;
     _context        = context;
     _serviceFactory = serviceFactory;
 }
Beispiel #3
0
        protected async Task storeCachedWeatherData(int IdPws, IEnumerable <Weather> lstWeather)
        {
            var insWeather = lstWeather.GroupBy(w => w.Dateutc.DayOfYear).GetAverage(windgustMax: true);

            using (var scope = _serviceFactory.CreateScope())
            {
                pwsstoreContext context = scope.ServiceProvider.GetRequiredService <pwsstoreContext>();
                await context.Weather.AddRangeAsync(insWeather);

                await context.SaveChangesAsync();
            }
        }
Beispiel #4
0
 public weatherController(IMemoryCache memoryCache, pwsstoreContext context, IServiceScopeFactory serviceFactory)
 {
     _memoryCache    = memoryCache;
     _context        = context;
     _serviceFactory = serviceFactory;
 }
Beispiel #5
0
 public CacheWeatherLogic(IMemoryCache memoryCache, pwsstoreContext context, IServiceScopeFactory serviceFactory)
 {
     _memCache       = memoryCache;
     _context        = context;
     _serviceFactory = serviceFactory;
 }