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


C# ClassEmitter.DefineCustomAttribute方法代码示例

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


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

示例1: Generate

		public virtual void Generate(ClassEmitter @class, ProxyGenerationOptions options)
		{
			var interceptors = @class.GetField("__interceptors");
#if !SILVERLIGHT
			ImplementGetObjectData(@class);
#endif
			ImplementProxyTargetAccessor(@class, interceptors);
			foreach (var attribute in targetType.GetNonInheritableAttributes())
			{
				@class.DefineCustomAttribute(attribute);
			}
		}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:12,代码来源:ProxyInstanceContributor.cs

示例2: Generate

		public virtual void Generate(ClassEmitter @class, ProxyGenerationOptions options)
		{
			var interceptors = @class.GetField("__interceptors");
#if FEATURE_SERIALIZATION
			ImplementGetObjectData(@class);
#endif
			ImplementProxyTargetAccessor(@class, interceptors);
			foreach (var attribute in targetType.GetTypeInfo().GetNonInheritableAttributes())
			{
				@class.DefineCustomAttribute(attribute.Builder);
			}
		}
开发者ID:textmetal,项目名称:main,代码行数:12,代码来源:ProxyInstanceContributor.cs

示例3: Generate

		public override void Generate(ClassEmitter @class, ProxyGenerationOptions options)
		{
			var interceptors = @class.GetField("__interceptors");
#if FEATURE_SERIALIZATION
			if (implementISerializable)
			{
				ImplementGetObjectData(@class);
				Constructor(@class);
			}
#endif
			ImplementProxyTargetAccessor(@class, interceptors);
			foreach (var attribute in targetType.GetNonInheritableAttributes())
			{
				@class.DefineCustomAttribute(attribute);
			}
		}
开发者ID:elevine,项目名称:Core,代码行数:16,代码来源:ClassProxyInstanceContributor.cs

示例4: CreateTypeAttributes

		protected virtual void CreateTypeAttributes(ClassEmitter emitter)
		{
			emitter.AddCustomAttributes(ProxyGenerationOptions);
#if !SILVERLIGHT
			emitter.DefineCustomAttribute<XmlIncludeAttribute>(new object[] { targetType });
#endif
		}
开发者ID:AGiorgetti,项目名称:Castle.Core,代码行数:7,代码来源:BaseProxyGenerator.cs

示例5: CreateTypeAttributes

		protected override void CreateTypeAttributes(ClassEmitter emitter)
		{
			base.CreateTypeAttributes(emitter);
#if (!SILVERLIGHT)
			emitter.DefineCustomAttribute<SerializableAttribute>();
#endif
		}
开发者ID:ThatExtraBit,项目名称:Castle.Core,代码行数:7,代码来源:InterfaceProxyWithTargetGenerator.cs

示例6: ReplicateNonInheritableAttributes

		protected void ReplicateNonInheritableAttributes(Type targetType, ClassEmitter emitter)
		{
			object[] attrs = targetType.GetCustomAttributes(false);

			foreach(Attribute attribute in attrs)
			{
				if (ShouldSkipAttributeReplication(attribute)) continue;

				emitter.DefineCustomAttribute(attribute);
			}
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:11,代码来源:BaseProxyGenerator.cs

示例7: CreateTypeAttributes

		protected override void CreateTypeAttributes(ClassEmitter emitter)
		{
			base.CreateTypeAttributes(emitter);
			emitter.DefineCustomAttribute<SerializableAttribute>();
		}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:5,代码来源:InterfaceProxyWithTargetGenerator.cs

示例8: CreateTypeAttributes

		protected virtual void CreateTypeAttributes(ClassEmitter emitter)
		{
			emitter.AddCustomAttributes(ProxyGenerationOptions);
#if FEATURE_SERIALIZATION
			emitter.DefineCustomAttribute<XmlIncludeAttribute>(new object[] { targetType });
#endif
		}
开发者ID:textmetal,项目名称:main,代码行数:7,代码来源:BaseProxyGenerator.cs

示例9: CreateTypeAttributes

 // If it turns out the proxy type needs a parameterless constructor,
 // override the BuildClassEmitter method here, call base, and then
 // add a constructor to the ClassEmitter like this:
 // emitter.CreateConstructor(new ArgumentReference[0]);
 // If it turns out custom attributes also need to be copied at the
 // method/property/field level, the appropriate overrides need to happen
 // just like the CreateTypeAttributes override, below.
 /// <summary>
 /// Adds custom attributes to the generated type.
 /// </summary>
 /// <param name="emitter">The class emitter.</param>
 /// <remarks>
 /// <para>
 /// This override calls the base functionality and then uses the metadata
 /// buddy class (as specified by a <see cref="Autofac.Extras.Multitenant.Wcf.ServiceMetadataTypeAttribute"/>
 /// on the service interface) to copy over class-level attributes to the
 /// dynamic hosting proxy.
 /// </para>
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// Thrown if <paramref name="emitter" /> is <see langword="null" />.
 /// </exception>
 protected override void CreateTypeAttributes(ClassEmitter emitter)
 {
     if (emitter == null)
     {
         throw new ArgumentNullException("emitter");
     }
     base.CreateTypeAttributes(emitter);
     if (_metadataBuddyType == null)
     {
         return;
     }
     var attribs = _metadataBuddyType.GetCustomAttributesData();
     foreach (var attrib in attribs)
     {
         var builder = attrib.ToAttributeBuilder();
         emitter.DefineCustomAttribute(builder);
     }
 }
开发者ID:RoymanJing,项目名称:Autofac,代码行数:40,代码来源:ServiceHostInterfaceProxyGenerator.cs


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