Exemplo n.º 1
0
 /// <summary>
 /// Resets the manager.
 /// </summary>
 internal static void Reset()
 {
     if (FailoverGroup != null)
     {
         FailoverGroup = null;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the host list to be used during failover operations.
        /// </summary>
        /// <param name="hostList">The host list.</param>
        /// <param name="failoverMethod">The failover method.</param>
        internal static void SetHostList(List <FailoverServer> hostList, FailoverMethod failoverMethod)
        {
            if (FailoverGroup != null)
            {
                return;
            }

            switch (failoverMethod)
            {
            case FailoverMethod.Sequential:
                FailoverGroup = new SequentialFailoverGroup(hostList);
                break;

            case FailoverMethod.Priority:
                FailoverGroup = new SequentialFailoverGroup(hostList.OrderByDescending(o => o.Priority).ToList());
                break;

            case FailoverMethod.Random:
                FailoverGroup = new RandomFailoverGroup(hostList);
                break;
            }
        }