示例#1
0
        /// <inheritdoc cref="IAutoTracker.TrackAsync{TResult}(Func{ITrackingScope, CancellationToken, Task{TResult}}, CancellationToken)"/>
        public static Task <TResult> TrackAsync <TResult>(this IAutoTracker tracker, Func <Task <TResult> > workload)
        {
            if (tracker is null)
            {
                throw new ArgumentNullException(nameof(tracker));
            }
            if (workload is null)
            {
                throw new ArgumentNullException(nameof(workload));
            }

            return(tracker.TrackAsync((scope, token) => workload()));
        }
示例#2
0
        /// <inheritdoc cref="IAutoTracker.TrackAsync(Func{ITrackingScope, CancellationToken, Task}, CancellationToken)"/>
        public static Task TrackAsync(this IAutoTracker tracker, Func <ITrackingScope, Task> workload)
        {
            if (tracker is null)
            {
                throw new ArgumentNullException(nameof(tracker));
            }
            if (workload is null)
            {
                throw new ArgumentNullException(nameof(workload));
            }

            return(tracker.TrackAsync((scope, token) => workload(scope)));
        }