GenerateCode() public method

public GenerateCode ( Type interfaces, ProxyGenerationOptions options ) : Type
interfaces System.Type
options ProxyGenerationOptions
return System.Type
Ejemplo n.º 1
0
		public Type CreateClassProxyType(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options)
		{
			AssertValidType(classToProxy);
			AssertValidTypes(additionalInterfacesToProxy);

			var generator = new ClassProxyGenerator(scope, classToProxy) { Logger = logger };
			return generator.GenerateCode(additionalInterfacesToProxy, options);
		}
Ejemplo n.º 2
0
		public virtual Type CreateClassProxy(Type theClass, ProxyGenerationOptions options)
		{
			AssertValidType(theClass);

			ClassProxyGenerator generator = new ClassProxyGenerator(scope, theClass);

			return generator.GenerateCode(null, options);
		}
Ejemplo n.º 3
0
		public Type CreateClassProxy(Type theClass, Type[] interfaces, ProxyGenerationOptions options)
		{
			AssertValidType(theClass);
			AssertValidTypes(interfaces);

			ClassProxyGenerator generator = new ClassProxyGenerator(scope, theClass);

			return generator.GenerateCode(interfaces, options);
		}
Ejemplo n.º 4
0
		public object RecreateClassProxy()
		{
			_delegateToBase = _info.GetBoolean ("__delegateToBase");

			ClassProxyGenerator cpGen = new ClassProxyGenerator(_scope, _baseType);

			Type proxy_type = cpGen.GenerateCode(_interfaces, _proxyGenerationOptions);


			if (_delegateToBase)
			{
				return Activator.CreateInstance(proxy_type, new object[] {_info, _context});
			}
			else
			{
				return FormatterServices.GetSafeUninitializedObject(proxy_type);
			}
		}