/// <summary> /// 选择负载均衡器 /// </summary> /// <param name="method"></param> /// <returns></returns> public LoadBalanceAbstract?Select(LoadBalanceMethod method) { return(method switch { LoadBalanceMethod.Random => serviceProvider.GetService <LoadBalanceRandom?>(), LoadBalanceMethod.None => serviceProvider.GetService <LoadBalanceNone?>(), LoadBalanceMethod.Increment => serviceProvider.GetService <LoadBalanceIncrement?>(), _ => throw new NotSupportedException(method.ToString()), });
/// <summary> /// 选择负载均衡器 /// </summary> /// <param name="method"></param> /// <returns></returns> public LoadBalanceAbstract Select(LoadBalanceMethod method) { switch (method) { case LoadBalanceMethod.Random: return(serviceProvider.GetService <LoadBalanceRandom>()); case LoadBalanceMethod.None: return(serviceProvider.GetService <LoadBalanceNone>()); case LoadBalanceMethod.Increment: return(serviceProvider.GetService <LoadBalanceIncrement>()); default: throw new NotSupportedException(method.ToString()); } }