public override List <T> FindAll() { if (CachingPolicy == CachingPolicy.Dictionary) { RefreshCacheIfNeed(); } if ((CachingPolicy != CachingPolicy.None) && (IsWholeCacheValid)) { return(_cache.GetAll()); } return(ReNewCacheFromBase()); }
public virtual void RestoreFromStream(Stream stream) { Debug.Assert(stream.CanRead, string.Format("stream \"{0}\" doesn't support Read operation", stream.GetType().FullName)); BinaryFormatter bf = new BinaryFormatter(); _cache = (EntityCache <T>)(bf.Deserialize(stream)); // suppose we should call AfterEntitiesLoaded() or overload Save/RestoreFromStream() // for specific local services to implement custom client serialization // of fields that was marked as non-serialized for better remoting performance AfterEntitiesLoaded(_cache.GetAll()); }