static LoadBalancingPolicyInfoProvider() { LoadBalancingPolicyInfoProvider.LoadBalancingPolicyOptionsProviders = new Dictionary <Type, Func <ILoadBalancingPolicy, IPolicyInfoMapper <IReconnectionPolicy>, Dictionary <string, object> > > { { typeof(DCAwareRoundRobinPolicy), (policy, reconnectionPolicyInfoMapper) => { var typedPolicy = (DCAwareRoundRobinPolicy)policy; return(new Dictionary <string, object> { #pragma warning disable 618 { "localDc", typedPolicy.LocalDc }, { "usedHostsPerRemoteDc", typedPolicy.UsedHostsPerRemoteDc } #pragma warning restore 618 }); } }, { typeof(DefaultLoadBalancingPolicy), (policy, reconnectionPolicyInfoMapper) => { var typedPolicy = (DefaultLoadBalancingPolicy)policy; return(new Dictionary <string, object> { { "childPolicy", LoadBalancingPolicyInfoProvider.GetLoadBalancingPolicyInfo(typedPolicy.ChildPolicy, reconnectionPolicyInfoMapper) } }); } }, { typeof(RetryLoadBalancingPolicy), (policy, reconnectionPolicyInfoMapper) => { var typedPolicy = (RetryLoadBalancingPolicy)policy; return(new Dictionary <string, object> { { "reconnectionPolicy", reconnectionPolicyInfoMapper.GetPolicyInformation(typedPolicy.ReconnectionPolicy) }, { "loadBalancingPolicy", LoadBalancingPolicyInfoProvider.GetLoadBalancingPolicyInfo(typedPolicy.LoadBalancingPolicy, reconnectionPolicyInfoMapper) } }); } }, { typeof(TokenAwarePolicy), (policy, reconnectionPolicyInfoMapper) => { var typedPolicy = (TokenAwarePolicy)policy; return(new Dictionary <string, object> { { "childPolicy", LoadBalancingPolicyInfoProvider.GetLoadBalancingPolicyInfo(typedPolicy.ChildPolicy, reconnectionPolicyInfoMapper) } }); } } }; }
public PolicyInfo GetPolicyInformation(ILoadBalancingPolicy policy) { return(LoadBalancingPolicyInfoProvider.GetLoadBalancingPolicyInfo(policy, _reconnectionPolicyInfoMapper)); }