/// <summary> /// /// </summary> /// <param name="serviceName"></param> public DataService(String serviceName) { ServiceName = serviceName; HasServerMetadata = true; UseJsonP = false; Adapter = new WebApiDataServiceAdapter(); JsonResultsAdapter = Adapter.JsonResultsAdapter; InitializeHttpClient(); }
/// <summary> /// Constructs a new DataService with the option to use an already configured HttpClient. If one is not provided /// then the DataService will create one internally. In either case it will be available via the HttpClient property. /// </summary> /// <remarks>Note that if an HttpClient is passed in that it MUST be a different instance than that provided /// to any other DataService. Whether passed in or created by the DataService, the HttpClient will automatically have /// its BaseAddress set and will be configured to support for a 'application/json' media type request header. /// </remarks> /// <param name="serviceName"></param> /// <param name="httpClient"></param> public DataService(String serviceName, HttpClient httpClient = null) { if (String.IsNullOrEmpty(serviceName)) { throw new ArgumentNullException("serviceName"); } ServiceName = serviceName; HasServerMetadata = true; UseJsonP = false; Adapter = new WebApiDataServiceAdapter(); JsonResultsAdapter = Adapter.JsonResultsAdapter; InitializeHttpClient(httpClient); }