Files
ServiceDashBored/Endpoint/ServiceEndpointFactory.cs
2025-10-11 09:44:08 -04:00

32 lines
892 B
C#

using System;
namespace Endpoint
{
/// <summary>
/// ServiceEndpointFactory
/// </summary>
public class ServiceEndpointFactory
{
/// <summary>
/// Creates the service endpoint based on the scheme
/// </summary>
/// <param name="config">The service endpoint configuration.</param>
/// <returns>The service endpoint.</returns>
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);
}
}
}