public async Task <IActionResult> LegacyCancellationWithCancellationGood()
        {
            var service = new LegacyService();

            var result = await service.DoAsyncOperation().WithCancellation(HttpContext.RequestAborted);

            return(Ok(result));
        }
Пример #2
0
        public async Task <IActionResult> AsyncCall()
        {
            var service = new LegacyService();

            var result = await service.DoAsyncOperation();

            return(Ok(result));
        }
        public async Task <IActionResult> LegacyCancellationWithTimeoutGood()
        {
            var service = new LegacyService();
            var timeout = TimeSpan.FromSeconds(10);

            var result = await service.DoAsyncOperation().TimeoutAfter(timeout);

            return(Ok(result));
        }