Example #1
0
        public void Add(ICacheableModel model)
        {
            Type type      = model.GetType();
            var  reference = new WeakReference(model);

            while (!type.Equals(model.GetBaseType()))
            {
                try
                {
                    var key = new ModelIdentifier(type, model.ModelId);
                    if (this.ContainsKey(key))
                    {
                        Replace(key, reference);
                    }
                    else
                    {
                        Add(key, reference);
                    }

                    type = type.BaseType;
                }
                catch (Exception e)
                {
                    throw new AddModelDictionaryItemException(type, model.ModelId, e);
                }
            }
        }
 public bool Equals(ModelIdentifier other)
 {
     return(Equals(other as IModelIdentifier));
 }