public T ReadType <T>(string key, Func <T> factory) where T : SerializableDataBase { this.requestedTypes[key] = factory; T t = default(T); if (this.reader.TryRead <T>(key, out t)) { this.TypeCacheHit(); } else { SerializableDataBase serializableDataBase = null; if (this.createdTypes.TryGetValue(key, out serializableDataBase)) { t = (serializableDataBase as T); this.TypeCacheHit(); } if (t == null) { t = factory(); this.createdTypes[key] = t; this.TypeCacheMiss(); } } return(t); }
internal void SetType(string key, SerializableDataBase value) { this.memento.TypeBag[key] = value; this.typeBag[key] = value; }