protected override Task ExecuteAsync() { using var scope = _serviceScopeFactory.CreateAsyncScope(); var counter = scope.ServiceProvider.GetRequiredService <IPerfCounter>(); counter.Process(); return(Task.CompletedTask); }
protected override Task ExecuteAsync() { using var scope = _scopeFactory.CreateAsyncScope(); var logger = scope.ServiceProvider.GetRequiredService <IRequestLogger>(); logger.Process(); return(Task.CompletedTask); }
protected override async Task <RandomWordResult> OnFindInDbAsync(int identity) { await using var scope = serviceScopeFactory.CreateAsyncScope(); var db = scope.ServiceProvider.GetRequiredService <AnfDbContext>(); var count = identity <= 0 ? Options.Value.IntervalCount : identity; var words = await GetRandomWordsAsync(db, count); var res = new RandomWordResult { CreateTime = DateTime.Now, LifeTime = Options.Value.IntervalTime, HitCount = 0, Words = words }; return(res); }