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 });
 }
示例#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 });
            }