public IEndpoint GetEndpoint(IConfigurationSection configSection) { var endpointTypeName = configSection.GetSection("Type").Value; if (string.IsNullOrWhiteSpace(endpointTypeName)) { throw new InvalidOperationException($"Missing Type in section {configSection.Path}."); } var endpoint = _customActivator.Activate <IEndpoint>(endpointTypeName, configSection); SetSerializer(endpoint, configSection.GetSection("Serializer")); configSection.Bind(endpoint); return(endpoint); }
public ErrorPolicyBase GetErrorPolicy(IConfigurationSection configSection) { var policyType = configSection.GetSection("Type").Value; if (string.IsNullOrWhiteSpace(policyType)) { throw new InvalidOperationException($"Missing Type in section {configSection.Path}."); } var errorPolicy = _customActivator.Activate <ErrorPolicyBase>( configSection, policyType, policyType + "Policy", policyType + "ErrorPolicy", policyType + "MessageErrorPolicy"); configSection.Bind(errorPolicy); SetApplyTo(errorPolicy, configSection.GetSection("ApplyTo")); SetExclude(errorPolicy, configSection.GetSection("Exclude")); SetMaxFailedAttempts(errorPolicy, configSection.GetSection("MaxFailedAttempts")); return(errorPolicy); }