GenerateCode() public méthode

public GenerateCode ( Type interfaces, Type targetType ) : Type
interfaces System.Type
targetType System.Type
Résultat System.Type
Exemple #1
0
		public virtual Type CreateCustomInterfaceProxy(Type[] interfaces, Type type, GeneratorContext context)
		{
			InterfaceProxyGenerator generator = new InterfaceProxyGenerator(_scope, context);
			return generator.GenerateCode(interfaces, type);
		}
		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;
		}
Exemple #3
0
		public virtual Type CreateInterfaceProxy(Type[] interfaces, Type type)
		{
			InterfaceProxyGenerator generator = new InterfaceProxyGenerator(_scope);
			return generator.GenerateCode(interfaces, type);
		}