Exemple #1
0
        protected virtual void CreateTypeAttributes(ClassEmitter emitter)
        {
            emitter.AddCustomAttributes(ProxyGenerationOptions);
#if FEATURE_SERIALIZATION
            emitter.DefineCustomAttribute <XmlIncludeAttribute>(new object[] { targetType });
#endif
        }
        protected override void CreateTypeAttributes(ClassEmitter emitter)
        {
            base.CreateTypeAttributes(emitter);
#if (!SILVERLIGHT)
            emitter.DefineCustomAttribute <SerializableAttribute>();
#endif
        }
Exemple #3
0
        protected virtual void CreateTypeAttributes(ClassEmitter emitter)
        {
            emitter.AddCustomAttributes(ProxyGenerationOptions);
#if !SILVERLIGHT
            emitter.DefineCustomAttribute <XmlIncludeAttribute>(new object[] { targetType });
#endif
        }
Exemple #4
0
 public void Generate(ClassEmitter emitter)
 {
     foreach (var attribute in targetType.GetNonInheritableAttributes())
     {
         emitter.DefineCustomAttribute(attribute.Builder);
     }
 }
        public override void Generate(ClassEmitter @class, ProxyGenerationOptions options)
        {
            var interceptors = @class.GetField("__interceptors");

            ImplementProxyTargetAccessor(@class, interceptors);
            foreach (var attribute in targetType.GetNonInheritableAttributes())
            {
                @class.DefineCustomAttribute(attribute);
            }
        }
Exemple #6
0
        public virtual void Generate(ClassEmitter @class, ProxyGenerationOptions options)
        {
            var interceptors = @class.GetField("__interceptors");

            ImplementGetObjectData(@class);
            ImplementProxyTargetAccessor(@class, interceptors);
            foreach (var attribute in targetType.GetTypeInfo().GetNonInheritableAttributes())
            {
                @class.DefineCustomAttribute(attribute.Builder);
            }
        }
Exemple #7
0
        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 AttributeUtil.GetNonInheritableAttributes(targetType))
            {
                @class.DefineCustomAttribute(attribute);
            }
        }
Exemple #8
0
        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.GetNonInheritableAttributes())
            {
                @class.DefineCustomAttribute(attribute);
            }
        }
        public override void Generate(ClassEmitter @class)
        {
            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.Builder);
            }
        }
        public override void Generate(ClassEmitter @class, ProxyGenerationOptions options)
        {
            var interceptors = @class.GetField("__interceptors");

#if !SILVERLIGHT
            if (implementISerializable)
            {
                ImplementGetObjectData(@class);
                Constructor(@class);
            }
#endif
            ImplementProxyTargetAccessor(@class, interceptors);
            foreach (var attribute in targetType.GetNonInheritableAttributes())
            {
                @class.DefineCustomAttribute(attribute);
            }
        }
Exemple #11
0
        // 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.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);
            }
        }
Exemple #12
0
 protected override void CreateTypeAttributes(ClassEmitter emitter)
 {
     base.CreateTypeAttributes(emitter);
     emitter.DefineCustomAttribute <SerializableAttribute>();
 }