/// <summary>
        /// 存储一个模型对象,如果存根管理器中没有该对象则增加该对象
        /// </summary>
        /// <param name="value">要存储的模型对象</param>
        public virtual void Save(IModelBase value)
        {
            Type            type            = value.GetType();
            ModelCollection modelCollection = this[type];

            if (modelCollection == null)
            {
                return;
            }
            if (modelCollection.Contains(value.Rid))
            {
                IModelBase   model = modelCollection[value.Rid];
                ModelMapping mf    = modelCollection.ModelField;
                foreach (PropertyFieldPair pfp in mf.PropertyFields)
                {
                    object obj = pfp.Property.GetValue(value, null);
                    pfp.Property.SetValue(model, obj, null);
                }
                while (mf.Parent != null)
                {
                    foreach (PropertyFieldPair pfp in mf.Parent.PropertyFields)
                    {
                        object obj = pfp.Property.GetValue(value, null);
                        pfp.Property.SetValue(model, obj, null);
                    }
                    mf = mf.Parent;
                }
                modelCollection.AddAltKey(value);
            }
            else
            {
                modelCollection.Add(value);
                modelCollection.AddAltKey(value);
                type = type.BaseType;
                while (type.BaseType != typeof(object) && type.Name != "ScadaModel")
                {
                    modelCollection = this[type.Name];
                    if (modelCollection.Contains(value.Rid))
                    {
                        IModelBase   model = modelCollection[value.Rid];
                        ModelMapping mf    = modelCollection.ModelField;
                        foreach (PropertyFieldPair pfp in mf.PropertyFields)
                        {
                            object obj = pfp.Property.GetValue(model, null);
                            pfp.Property.SetValue(value, obj, null);
                        }
                        modelCollection.Remove(value.Rid);
                        modelCollection.RemoveAltKey(value);
                    }
                    modelCollection.Add(value);
                    modelCollection.AddAltKey(value);
                    type = type.BaseType;
                }
            }
            value.Initialize();
            if (ModelSaved != null)
            {
                ModelSaved(this, new ModelCacheChangedEventArgs(value.GetType(), value.Rid));
            }
        }
        /// <summary>
        /// 移除一个模型对象
        /// </summary>
        /// <param name="value">要移除的模型对象</param>
        public virtual void Remove(IModelBase value)
        {
            if (value == null)//于艳辉添加
            {
                return;
            }
            Type type = value.GetType();

            while (type.BaseType != typeof(object))
            {
                ModelCollection modelCollection = this[type.Name];
                if (modelCollection != null &&
                    modelCollection.Contains(value.Rid))
                {
                    IModelBase model = modelCollection[value.Rid];
                    modelCollection.Remove(model);
                    modelCollection.RemoveAltKey(model);
                }
                type = type.BaseType;
            }
            if (ModelRemoved != null)
            {
                ModelRemoved(this, new ModelCacheChangedEventArgs(value));
            }
        }