예제 #1
0
        private void Add(ServiceModelOptions options, IEnumerable endpoints)
        {
            if (endpoints is null)
            {
                return;
            }

            foreach (var endpoint in endpoints.OfType <IEndpoint>())
            {
                options.Services.Add(_mapper.ResolveContract(endpoint.Contract), o =>
                {
                    o.Endpoint = new EndpointAddress(endpoint.Address);

                    if (!string.IsNullOrEmpty(endpoint.Binding) || !string.IsNullOrEmpty(endpoint.BindingConfiguration))
                    {
                        o.Binding = ConfigLoader.LookupBinding(endpoint.Binding, endpoint.BindingConfiguration, ConfigurationHelpers.GetEvaluationContext(endpoint));
                    }
                });
            }
        }