/// <summary> /// Gets the endpoints configuration. /// </summary> /// <param name="endpointsNode">The endpoints node.</param> /// <returns></returns> /// <exception cref="System.InvalidOperationException"> /// The 'baseUrl' value should be a valid URL. /// </exception> protected virtual EndpointsConfiguration GetEndpointsConfiguration(XmlNode endpointsNode) { var baseUrlNode = endpointsNode.Attributes["baseUrl"]; Assert.NotNull(baseUrlNode, "The 'baseUrl' attribute is required for the 'komfoSharp/services/endpoints' node."); Assert.NotNullOrEmpty(baseUrlNode.Value, "The 'baseUrl' value should be a valid URL."); Uri baseUrl; if (!Uri.TryCreate(baseUrlNode.Value, UriKind.Absolute, out baseUrl) || !(baseUrl.Scheme == Uri.UriSchemeHttp || baseUrl.Scheme == Uri.UriSchemeHttps)) { throw new InvalidOperationException("The 'baseUrl' value should be a valid URL."); } var endpoints = new List <EndpointBase>(); foreach (XmlNode node in endpointsNode.ChildNodes) { var endpoint = this.DeserializeEndpoint(node); endpoints.Add(endpoint); } var endpointsConfiguration = new EndpointsConfiguration(endpoints, new Uri(baseUrlNode.Value)); return(endpointsConfiguration); }
/// <summary> /// Initializes a new instance of the <see cref="KomfoProvider" /> class. /// </summary> /// <param name="configurationProvider">The configuration provider.</param> public KomfoProvider(IConfigurationProvider configurationProvider) { this.endpointsConfiguration = configurationProvider.GetConfiguration().EndpointsConfiguration; }
public EndpointRoutingConvention(IOptions <EndpointsConfiguration> endpointsConfiguration) { this.endpointsConfiguration = endpointsConfiguration.Value; }