DALs.Http/RestClient.cs
/// <summary>
/// get as an asynchronous operation.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="config">The configuration.</param>
/// <param name="loader">The loader.</param>
/// <returns>Task&lt;T&gt;.</returns>
/// <exception cref="System.ArgumentException">
/// </exception>
get as an asynchronous operation.
get as an asynchronous operation .
public virtual async Task<T> GetAsync<T>(HttpConfiguration config, Func<HttpResponseMessage, T> loader)
        {
            config.ValidateGet();
            using (var client = inits.HttpClient)
            {
                client.BaseAddress = config.Uri;
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var response = await client.GetAsync(config.Route);
                return loader(response);
            }
        }
public virtual async Task < T > GetAsync < T > ( HttpConfiguration config , Func < HttpResponseMessage , T > loader ) { config . ValidateGet ( ) ; using ( var client = inits . HttpClient ) { client . BaseAddress = config . Uri ; client . DefaultRequestHeaders . Accept . Clear ( ) ; client . DefaultRequestHeaders . Accept . Add ( new MediaTypeWithQualityHeaderValue ( " " ) ) ; var response = await client . GetAsync ( config . Route ) ; return loader ( response ) ; } }
get as an asynchronous operation.
get as an asynchronous operation .
None
None
config
HttpConfiguration
None
loader
Func<HttpResponseMessage, T>
None
typeparam
None