示例#1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="msgId">数据类型ID</param>
        /// <param name="key">Key</param>
        /// <returns>删除成功返回true,失败返回false</returns>
        internal bool Remove(uint msgId, string key)
        {
            TableCache tableCache = null;

            m_TableCacheDict.TryGetValue(msgId, out tableCache);
            if (tableCache != null)
            {
                return(tableCache.Remove(key));
            }
            return(false);
        }
示例#2
0
        /// <summary>
        /// 外键查找
        /// </summary>
        /// <param name="msgId">数据类型ID</param>
        /// <param name="key">外键</param>
        /// <returns></returns>
        internal List <DataValue> FindByForeignKey(uint msgId, string foreignKey)
        {
            TableCache tableCache = null;

            m_TableCacheDict.TryGetValue(msgId, out tableCache);
            if (tableCache != null)
            {
                return(tableCache.FindByForeignKey(foreignKey));
            }
            return(new List <DataValue>());
        }
示例#3
0
        /// <summary>
        /// 表查找
        /// </summary>
        /// <param name="msgId">数据表ID</param>
        /// <returns>该表对应所有的值</returns>
        internal List <DataValue> FindTable(uint msgId)
        {
            TableCache tableCache = null;

            m_TableCacheDict.TryGetValue(msgId, out tableCache);
            if (tableCache != null)
            {
                return(tableCache.GetDataValues());
            }
            return(new List <DataValue>());
        }
示例#4
0
        /// <summary>
        /// 主键查找
        /// </summary>
        /// <param name="msgId">数据类型ID</param>
        /// <param name="key">主键</param>
        /// <returns>查找成功返回对应数据对象,不存在返回null</returns>
        internal DataValue Find(uint msgId, string key)
        {
            TableCache tableCache = null;

            m_TableCacheDict.TryGetValue(msgId, out tableCache);
            if (tableCache != null)
            {
                return(tableCache.Find(key));
            }
            return(null);
        }
示例#5
0
        /// <summary>
        /// 添加或更新
        /// </summary>
        /// <param name="msgId">数据类型ID</param>
        /// <param name="key">Key</param>
        /// <param name="dataMessage">待添加的数据对象</param>
        internal void AddOrUpdate(uint msgId, string key, string foreignKey, IMessage dataMessage)
        {
            if (dataMessage == null)
            {
                return;
            }
            DataValue  dataValue  = new DataValue(dataMessage);
            TableCache tableCache = null;

            m_TableCacheDict.TryGetValue(msgId, out tableCache);
            if (tableCache != null)
            {
                tableCache.AddOrUpdate(key, foreignKey, dataMessage);
            }
            else
            {
                TableCache newTableCache = new TableCache();
                newTableCache.AddOrUpdate(key, foreignKey, dataMessage);
                m_TableCacheDict.Add(msgId, newTableCache);
            }
        }