public string GetOracleServerConnectionString(ActionEnum actionEnum, string dbNodeName)
        {
            if (!_boolInital)
            {
                InitalCustomDBProxyConfigManagement(GroupTypeEnum.OracleServer, dbNodeName);
            }

            TimeSpan tsEnd = TimeSpan.FromTicks(DateTime.Now.Ticks);

            if (actionEnum == ActionEnum.Read)
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int        actionNodeNewCompositeWeight = _randomDBNodeTotalCompositeWeight.Next(1, _dbNodeTotalCompositeWeight);
                    ActionNode actionNode = GetActionNodeByNewCompositeWeight(actionNodeNewCompositeWeight, _currentDBNode);
                    return(actionNode.ConnectionString);
                }
                else
                {
                    return(_lastWriteOprationConnectionString);
                }
            }
            else
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int        readWriteActionNodeNewCompositeWeight = _randomDBNodeReadWriteTotalCompositeWeight.Next(1, _dbNodeReadWriteTotalCompositeWeight);
                    ActionNode actionNode = GetReadWriteActionNodeByNewCompositeWeight(readWriteActionNodeNewCompositeWeight, _currentReadWriteActionNodes);
                    LastWriteOprationTimeSpan          = TimeSpan.FromTicks(DateTime.Now.Ticks);
                    _lastWriteOprationConnectionString = actionNode.ConnectionString;
                    return(actionNode.ConnectionString);
                }
                else
                {
                    return(_lastWriteOprationConnectionString);
                }
            }
        }
        protected DBNode SetActionNodesCompositeWeight(CustomDBGroup customDBGroup, string dbNodeName, out int dbNodeTotalCompositeWeight, out IList <ActionNode> readWriteActionNodes, out int dbNodeReadWriteTotalCompositeWeight)
        {
            int intReadWriteImpactFactor = customDBGroup.DBNodes.ReadWriteImpactFactor;
            int intConstReadWrite        = customDBGroup.DBNodes.ConstReadWrite;
            int intConstRead             = customDBGroup.DBNodes.ConstRead;

            DBNode dbNode = GetCurrentDBNode(customDBGroup.GroupTypeEnum, dbNodeName);

            foreach (ActionNode aNode in dbNode)
            {
                switch (aNode.ActionEnum)
                {
                case ActionEnum.Read:
                    aNode.CompositeWeight = intReadWriteImpactFactor * intConstRead + aNode.Weight;
                    break;

                case ActionEnum.ReadWrite:
                    aNode.CompositeWeight = intReadWriteImpactFactor * intConstReadWrite + aNode.Weight;
                    break;
                }
            }

            var objActionList = from a in dbNode.Cast <ActionNode>()
                                orderby a.CompositeWeight ascending
                                select a;

            foreach (ActionNode aNode in objActionList)
            {
                var objListP = from n in objActionList
                               where n.CompositeWeight <= aNode.CompositeWeight
                               select n;

                int intTotalCompositeWeight = objListP.Sum <ActionNode>(actionNode => actionNode.CompositeWeight);

                aNode.CompositeWeightRangeEnd   = intTotalCompositeWeight;
                aNode.CompositeWeightRangeStart = intTotalCompositeWeight - aNode.CompositeWeight + 1;
            }

            dbNodeTotalCompositeWeight = objActionList.Sum <ActionNode>(actionNode => actionNode.CompositeWeight);


            var objReadWriteActionNodeList = from aNode in objActionList
                                             where aNode.ActionEnum == ActionEnum.ReadWrite
                                             select aNode;

            dbNodeReadWriteTotalCompositeWeight = objReadWriteActionNodeList.Sum <ActionNode>(aNode => aNode.CompositeWeight);

            List <ActionNode> listReadWriteActionNodes = new List <ActionNode>();

            foreach (ActionNode aNode in objReadWriteActionNodeList)
            {
                var objListP = from n in objReadWriteActionNodeList
                               where n.CompositeWeight <= aNode.CompositeWeight
                               select n;

                int intTotalReadWriteCompositeWeight = objListP.Sum <ActionNode>(actionNode => actionNode.CompositeWeight);

                ActionNode tempNode = new ActionNode(aNode.Name, aNode.ActionEnum, aNode.Weight, aNode.CompositeWeight, intTotalReadWriteCompositeWeight - aNode.CompositeWeight + 1, intTotalReadWriteCompositeWeight, aNode.ConnectionString);

                listReadWriteActionNodes.Add(tempNode);
            }

            readWriteActionNodes = listReadWriteActionNodes;

            return(dbNode);
        }
        protected DBNode SetActionNodesCompositeWeight(CustomDBGroup customDBGroup, string dbNodeName, out int dbNodeTotalCompositeWeight, out IList<ActionNode> readWriteActionNodes, out int dbNodeReadWriteTotalCompositeWeight)
        {
            int intReadWriteImpactFactor = customDBGroup.DBNodes.ReadWriteImpactFactor;
            int intConstReadWrite = customDBGroup.DBNodes.ConstReadWrite;
            int intConstRead = customDBGroup.DBNodes.ConstRead;

            DBNode dbNode = GetCurrentDBNode(customDBGroup.GroupTypeEnum, dbNodeName);

            foreach (ActionNode aNode in dbNode)
            {
                switch (aNode.ActionEnum)
                {
                    case ActionEnum.Read:
                        aNode.CompositeWeight = intReadWriteImpactFactor * intConstRead + aNode.Weight;
                        break;
                    case ActionEnum.ReadWrite:
                        aNode.CompositeWeight = intReadWriteImpactFactor * intConstReadWrite + aNode.Weight;
                        break;
                }
            }

            var objActionList = from a in dbNode.Cast<ActionNode>()
                                orderby a.CompositeWeight ascending
                                select a;

            foreach (ActionNode aNode in objActionList)
            {
                var objListP = from n in objActionList
                               where n.CompositeWeight <= aNode.CompositeWeight
                               select n;

                int intTotalCompositeWeight = objListP.Sum<ActionNode>(actionNode => actionNode.CompositeWeight);

                aNode.CompositeWeightRangeEnd = intTotalCompositeWeight;
                aNode.CompositeWeightRangeStart = intTotalCompositeWeight - aNode.CompositeWeight + 1;
            }

            dbNodeTotalCompositeWeight = objActionList.Sum<ActionNode>(actionNode => actionNode.CompositeWeight);


            var objReadWriteActionNodeList = from aNode in objActionList
                                             where aNode.ActionEnum == ActionEnum.ReadWrite
                                             select aNode;

            dbNodeReadWriteTotalCompositeWeight = objReadWriteActionNodeList.Sum<ActionNode>(aNode => aNode.CompositeWeight);

            List<ActionNode> listReadWriteActionNodes = new List<ActionNode>();

            foreach (ActionNode aNode in objReadWriteActionNodeList)
            {
                var objListP = from n in objReadWriteActionNodeList
                               where n.CompositeWeight <= aNode.CompositeWeight
                               select n;

                int intTotalReadWriteCompositeWeight = objListP.Sum<ActionNode>(actionNode => actionNode.CompositeWeight);

                ActionNode tempNode = new ActionNode(aNode.Name, aNode.ActionEnum, aNode.Weight, aNode.CompositeWeight, intTotalReadWriteCompositeWeight - aNode.CompositeWeight + 1, intTotalReadWriteCompositeWeight, aNode.ConnectionString);

                listReadWriteActionNodes.Add(tempNode);
            }

            readWriteActionNodes = listReadWriteActionNodes;                       

            return dbNode;
        }