public Type CreateInterfaceProxyTypeWithTargetInterface(Type theInterface, ProxyGenerationOptions options) { AssertValidType(theInterface); InterfaceProxyWithTargetInterfaceGenerator generator = new InterfaceProxyWithTargetInterfaceGenerator(scope, theInterface); return generator.GenerateCode(theInterface, null, options); }
public Type CreateInterfaceProxyTypeWithTargetInterface(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) { AssertValidType(interfaceToProxy); AssertValidTypes(additionalInterfacesToProxy); var generator = new InterfaceProxyWithTargetInterfaceGenerator(scope, interfaceToProxy) { Logger = logger }; return generator.GenerateCode(interfaceToProxy, additionalInterfacesToProxy, options); }
public object RecreateInterfaceProxy() { InterfaceGeneratorType generatorType = (InterfaceGeneratorType) _info.GetInt32("__interface_generator_type"); Type theInterface = DeserializeTypeFromString ("__theInterface"); Type targetType = DeserializeTypeFromString ("__targetFieldType"); InterfaceProxyWithTargetGenerator generator; switch(generatorType) { case InterfaceGeneratorType.WithTarget: generator = new InterfaceProxyWithTargetGenerator(_scope, theInterface); break; case InterfaceGeneratorType.WithoutTarget: generator = new InterfaceProxyWithoutTargetGenerator(_scope, theInterface); break; case InterfaceGeneratorType.WithTargetInterface: generator = new InterfaceProxyWithTargetInterfaceGenerator(_scope, theInterface); break; default: throw new InvalidOperationException( string.Format( "Got value {0} for the interface generator type, which is not known for the purpose of serialization.", generatorType)); } Type proxy_type = generator.GenerateCode(targetType, _interfaces, _proxyGenerationOptions); return FormatterServices.GetSafeUninitializedObject (proxy_type); }