/// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <Fee> Get(this IFeeOperations operations, string locationId, bool isContinous = false) { //return new ActiveList<Fee> //{ // _Fees = Task // .Factory // .StartNew(s => ((IFeeOperations)s).GetAsync(locationId, beginTime, endTime, listOrder, limit), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default) // .Unwrap() // .GetAwaiter() // .GetResult(), //}; var task = Task.Run(() => operations.GetWithHttpMessagesAsync(locationId, null)); task.Wait(); return(new ActiveList <Fee> { InitialUri = task.Result.Request.RequestUri.AbsoluteUri, Collection = task.Result.Body, NextUri = task.Result.ToNextUri(), Operations = operations, IsContinous = isContinous, }); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <Fee> > GetAsync(this IFeeOperations operations, string locationId, bool isContinous = false, CancellationToken cancellationToken = default(CancellationToken)) { using (var result = await operations.GetWithHttpMessagesAsync(locationId, null, cancellationToken).ConfigureAwait(false)) { return(new ActiveList <Fee> { InitialUri = result.Request.RequestUri.AbsoluteUri, Collection = result.Body, NextUri = result.ToNextUri(), Operations = operations, IsContinous = isContinous, CancellationToken = cancellationToken, }); } }