상속: InterfaceProxyWithTargetGenerator
예제 #1
0
		public Type CreateInterfaceProxyTypeWithoutTarget(Type theInterface, Type[] interfaces, ProxyGenerationOptions options)
		{
			AssertValidType(theInterface);
			AssertValidTypes(interfaces);

			InterfaceProxyWithoutTargetGenerator generatorWithoutTarget =
				new InterfaceProxyWithoutTargetGenerator(scope, theInterface);

			return generatorWithoutTarget.GenerateCode(typeof(object), interfaces, options);
		}
예제 #2
0
		public Type CreateInterfaceProxyTypeWithoutTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options)
		{
			AssertValidType(interfaceToProxy);
			AssertValidTypes(additionalInterfacesToProxy);

			InterfaceProxyWithoutTargetGenerator generatorWithoutTarget =
				new InterfaceProxyWithoutTargetGenerator(scope, interfaceToProxy);

			return generatorWithoutTarget.GenerateCode(typeof(object), additionalInterfacesToProxy, options);
		}
예제 #3
0
		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);
		}