using System;
namespace Endpoint
{
///
/// ServiceEndpointFactory
///
public class ServiceEndpointFactory
{
///
/// Creates the service endpoint based on the scheme
///
/// The service endpoint configuration.
/// The service endpoint.
public static IServiceEndpoint CreateServiceEndpoint(IServiceEndpointConfiguration config)
{
Type type = config.GetType();
if (type == typeof(HtmlEndpointConfiguration))
return new HtmlEndpoint((HtmlEndpointConfiguration)config);
if (type == typeof(HttpEndpointConfiguration))
return new HttpEndpoint((HttpEndpointConfiguration)config);
if (type == typeof(OracleEndpointConfiguration))
return new OracleEndpoint((OracleEndpointConfiguration)config);
throw new ArgumentException("Unknown type: " + type);
}
}
}