Inheritance: BaseCodeGenerator
Example #1
0
		public virtual Type CreateCustomInterfaceProxy(Type[] interfaces, Type type, GeneratorContext context)
		{
			InterfaceProxyGenerator generator = new InterfaceProxyGenerator(_scope, context);
			return generator.GenerateCode(interfaces, type);
		}
Example #2
0
		public object RecreateInterfaceProxy(SerializationInfo info, StreamingContext context)
		{
			object proxy = null;

			GeneratorContext genContext = new GeneratorContext();

			foreach(object mixin in _mixins)
			{
				genContext.AddMixinInstance(mixin);
			}

			InterfaceProxyGenerator gen = new InterfaceProxyGenerator( _scope, genContext );

			object target = info.GetValue("__target", typeof(object));

			if (_mixins.Length == 0)
			{
				Type proxy_type = gen.GenerateCode( _interfaces, target.GetType());

				proxy = Activator.CreateInstance( proxy_type, new object[] { _interceptor, target } );
			}
			else
			{
				Type proxy_type = gen.GenerateCode( _interfaces, target.GetType() );

				proxy = Activator.CreateInstance( proxy_type, new object[] { _interceptor, target, genContext.MixinsAsArray() } );
			}

			return proxy;
		}
Example #3
0
		public virtual Type CreateInterfaceProxy(Type[] interfaces, Type type)
		{
			InterfaceProxyGenerator generator = new InterfaceProxyGenerator(_scope);
			return generator.GenerateCode(interfaces, type);
		}