/// <summary> /// Initializes a new instance of the <see cref="ServiceExtension{TService}"/> class using the specified service /// client and HTTP API call factory. /// </summary> /// <param name="service">The service instance.</param> /// <param name="httpApiCallFactory">The factory to use for creating new HTTP API calls for the /// extension.</param> /// <exception cref="ArgumentNullException"> /// <para>If <paramref name="service"/> is <see langword="null"/>.</para> /// <para>-or-</para> /// <para>If <paramref name="httpApiCallFactory"/> is <see langword="null"/>.</para> /// </exception> protected ServiceExtension(TService service, IHttpApiCallFactory httpApiCallFactory) { if (service == null) { throw new ArgumentNullException("service"); } if (httpApiCallFactory == null) { throw new ArgumentNullException("httpApiCallFactory"); } _service = service; _httpApiCallFactory = httpApiCallFactory; }
/// <summary> /// Creates a default instance of the extension. /// </summary> /// <remarks> /// Service client implementations are given the first opportunity to create an instance of /// <typeparamref name="TExtension"/> for a particular service extension definition. To improve flexibility in /// using vendor-specific extensions, service extension definitions support creating default instances of a /// service extension if the service client implementation does not provide its own implementation. /// </remarks> /// <param name="service">The service client instance.</param> /// <param name="httpApiCallFactory">The factory to use for creating new HTTP API calls for the /// extension.</param> /// <returns> /// A default instance of <typeparamref name="TExtension"/> for the specified service client. /// </returns> /// <exception cref="ArgumentNullException"> /// <para>If <paramref name="service"/> is <see langword="null"/>.</para> /// <para>-or-</para> /// <para>If <paramref name="httpApiCallFactory"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="NotSupportedException"> /// If the service extension definition does not provide a default implementation. /// </exception> public abstract TExtension CreateDefaultInstance(TService service, IHttpApiCallFactory httpApiCallFactory);