当前位置: 首页>>代码示例>>C#>>正文


C# GeneratorContext.MixinsAsArray方法代码示例

本文整理汇总了C#中GeneratorContext.MixinsAsArray方法的典型用法代码示例。如果您正苦于以下问题:C# GeneratorContext.MixinsAsArray方法的具体用法?C# GeneratorContext.MixinsAsArray怎么用?C# GeneratorContext.MixinsAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeneratorContext的用法示例。


在下文中一共展示了GeneratorContext.MixinsAsArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RecreateInterfaceProxy

		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;
		}
开发者ID:atczyc,项目名称:castle,代码行数:30,代码来源:ProxyObjectReference.cs

示例2: RecreateClassProxy

		public object RecreateClassProxy(SerializationInfo info, StreamingContext context)
		{
			bool delegateBaseSer = info.GetBoolean("__delegateToBase");

			if (!delegateBaseSer)
			{
				_data = (object[]) info.GetValue("__data", typeof(object[]) );
			}

			object proxy = null;

			GeneratorContext genContext = new GeneratorContext();
			
			if (_mixins.Length != 0)
			{
				foreach(object mixin in _mixins)
				{
					genContext.AddMixinInstance(mixin);
				}
			}

			ClassProxyGenerator cpGen = new ClassProxyGenerator( _scope, genContext );

			Type proxy_type;

			if (_mixins.Length == 0)
			{
				proxy_type = cpGen.GenerateCode( _baseType, _interfaces );
			}
			else
			{
				proxy_type = cpGen.GenerateCustomCode( _baseType, _interfaces );
			}

			if (delegateBaseSer)
			{
				proxy = Activator.CreateInstance( proxy_type, new object[] { info, context } );
			}
			else
			{
				if (_mixins.Length == 0)
				{
					proxy = Activator.CreateInstance( proxy_type, new object[] { _interceptor } );
				}
				else
				{
					ArrayList args = new ArrayList();
					args.Add(_interceptor);
					args.Add(genContext.MixinsAsArray());
					
					proxy = Activator.CreateInstance( proxy_type, args.ToArray() );
				}

				MemberInfo[] members = FormatterServices.GetSerializableMembers( _baseType );
				FormatterServices.PopulateObjectMembers(proxy, members, _data);
			}

			return proxy;
		}
开发者ID:atczyc,项目名称:castle,代码行数:59,代码来源:ProxyObjectReference.cs


注:本文中的GeneratorContext.MixinsAsArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。