/// <summary> /// Deserialisiert für den WebService-Proxytyp <paramref name="webServiceType"/> den zugehörigen SoapClientType und /// registriert diesen im statischen Cache von <see cref="WebClientProtocol"/>. /// </summary> /// <param name="webServiceType">Der WebService-Proxytyp.</param> public static void DeserializeClientType(Type webServiceType) { using (var log = new EnterExitLogger(s_log, Level.Info, "webServiceType = {0}", webServiceType)) { if (!IsCached(webServiceType)) { var filename = GetSerializerPath(webServiceType); if (File.Exists(filename)) { var formatter = new BinaryFormatter(); var webClientProtocolReflector = new TypeReflector(typeof(WebClientProtocol)); var cache = webClientProtocolReflector.GetField("cache"); var cacheReflector = new TypeReflector(cache.GetType()); //debug: var cacheHashtable = (Hashtable)cacheReflector.GetField(cache, "cache"); object deserializedClientType = null; using (var stream = new FileStream(filename, FileMode.Open)) { deserializedClientType = TypeSerializer.Deserialize(formatter, stream); webClientProtocolReflector.Invoke("AddToCache(System.Type, System.Object)", new object[] { webServiceType, deserializedClientType }); log.Log("added to WebClient cache: {0}", deserializedClientType); } } } } }