Ejemplo n.º 1
0
 protected ProxyObjectReference(SerializationInfo info, StreamingContext context)
 {
     string typeName = info.GetString("__baseType");
     _baseType = Type.GetType(typeName, true, false);
     var baseInterfaces = new List<Type>();
     int count = info.GetInt32("__baseInterfaceCount");
     for (int index = 0; index < count; index++)
     {
         string name = string.Format("__baseInterface{0}", index);
         baseInterfaces.Add(Type.GetType(info.GetString(name), true, false));
     }
     var proxyType = new DynamicProxyBuilder().CreateProxiedType(_baseType, baseInterfaces.ToArray());
     _proxy = (IDynamicProxy)Activator.CreateInstance(proxyType, new object[] { info, context });
 }
Ejemplo n.º 2
0
            protected ProxyObjectReference(SerializationInfo info, StreamingContext context)
            {
                string typeName = info.GetString("__baseType");

                _baseType = Type.GetType(typeName, true, false);
                var baseInterfaces = new List <Type>();
                int count          = info.GetInt32("__baseInterfaceCount");

                for (int index = 0; index < count; index++)
                {
                    string name = string.Format("__baseInterface{0}", index);
                    baseInterfaces.Add(Type.GetType(info.GetString(name), true, false));
                }
                var proxyType = new DynamicProxyBuilder().CreateProxiedType(_baseType, baseInterfaces.ToArray());

                _proxy = (IDynamicProxy)Activator.CreateInstance(proxyType, new object[] { info, context });
            }