public bool FindExists(SessionBase session)
        {
            bool find = false;
            var notFind = new List<int>();
            for (int i = 0; i < sessionEntries.Count; i++)
            {
                if (sessionEntries[i].FindExists(session))
                {
                    find = true;
                }
                else
                {
                    notFind.Add(i);
                }
            }

            //同步需要保存的会话
            if (find && notFind.Count > 0)
            {
                foreach (int t in notFind)
                {
                    if (sessionEntries[t].NeedSynchronize)
                    {
                        sessionEntries[t].InsertOne(session);
                    }
                }
            }
            return find;
        }
 public bool FindExists(SessionBase session)
 {
     bool result = false;
     DataAccessManager.ExecuteCommand("IsSessionExists", cmd =>
         {
             result = cmd.ExecuteScalar<bool>(new {Session = session.SessionText});
         });
     return result;
 }
        public bool FindExists(SessionBase session)
        {
            if (!IsValid(session))
            {
                return false;
            }
            int rank1 = GetRank(session.SessionText[0]);
            int rank2 = GetRank(session.SessionText[1]);
            int rank3 = GetRank(session.SessionText[2]);

            return SessionMemoryCache[rank1][rank2][rank3].Find(session.SessionText);
        }
 public bool InsertOne(SessionBase session)
 {
     bool allSuccess = true;
     foreach (ISessionEntry communication in sessionEntries)
     {
         if (!communication.InsertOne(session))
         {
             allSuccess = false;
         }
     }
     return allSuccess;
 }
        public bool InsertOne(SessionBase session)
        {
            if (!IsValid(session))
            {
                return false;
            }
            int rank1 = GetRank(session.SessionText[0]);
            int rank2 = GetRank(session.SessionText[1]);
            int rank3 = GetRank(session.SessionText[2]);

            try
            {
                SessionMemoryCache[rank1][rank2][rank3].InsertSession(session.SessionText);
            }
            catch (Exception)
            {
                return false;
            }
            return true;
        }
 private bool IsValid(SessionBase session)
 {
     return !string.IsNullOrWhiteSpace(session.SessionText) && session.SessionText.Length >= 3;
 }
 public bool InsertOne(SessionBase session)
 {
     throw new NotSupportedException();
 }