Beispiel #1
0
        /// <summary>
        /// Initialization method.
        /// </summary>
        /// <param name="advised">The proxy configuration.</param>
        /// <param name="proxy">
        /// The current <see cref="Spring.Aop.Framework.IAopProxy"/> implementation.
        /// </param>
        protected void Initialize(IAdvised advised, IAopProxy proxy)
        {
            this.m_advised    = advised;
            this.m_targetType = advised.TargetSource.TargetType;

            // initialize target
            if (advised.TargetSource.IsStatic)
            {
                this.m_targetSourceWrapper = new StaticTargetSourceWrapper(advised.TargetSource);
            }
            else
            {
                this.m_targetSourceWrapper = new DynamicTargetSourceWrapper(advised.TargetSource);
            }

            // initialize introduction advice
            this.m_introductions = new IAdvice[advised.Introductions.Length];
            for (int i = 0; i < advised.Introductions.Length; i++)
            {
                this.m_introductions[i] = advised.Introductions[i].Advice;

                // set target proxy on introduction instance if it implements ITargetAware
                if (this.m_introductions[i] is ITargetAware)
                {
                    ((ITargetAware)this.m_introductions[i]).TargetProxy = proxy;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="info">Serialization data.</param>
 /// <param name="context">Serialization context.</param>
 protected AdvisedProxy(SerializationInfo info, StreamingContext context)
 {
     m_advised             = (IAdvised)info.GetValue("advised", typeof(IAdvised));
     m_introductions       = (IAdvice[])info.GetValue("introductions", typeof(IAdvice[]));
     m_targetSourceWrapper = (ITargetSourceWrapper)info.GetValue("tsWrapper", typeof(ITargetSourceWrapper));
     m_targetType          = (Type)info.GetValue("targetType", typeof(Type));
 }
        /// <summary>
        /// Initialization method.
        /// </summary>
        /// <param name="advised">The proxy configuration.</param>
        /// <param name="proxy">
        /// The current <see cref="Spring.Aop.Framework.IAopProxy"/> implementation.
        /// </param>
        protected void Initialize(IAdvised advised, IAopProxy proxy)
        {
            this.m_advised = advised;
            this.m_targetType = advised.TargetSource.TargetType;

            // initialize target
            if (advised.TargetSource.IsStatic)
            {
                this.m_targetSourceWrapper = new StaticTargetSourceWrapper(advised.TargetSource);
            }
            else
            {
                this.m_targetSourceWrapper = new DynamicTargetSourceWrapper(advised.TargetSource);
            }

            // initialize introduction advice
            this.m_introductions = new IAdvice[advised.Introductions.Length];
            for (int i = 0; i < advised.Introductions.Length; i++)
            {
                this.m_introductions[i] = advised.Introductions[i].Advice;

                // set target proxy on introduction instance if it implements ITargetAware
                if (this.m_introductions[i] is ITargetAware)
                {
                    ((ITargetAware)this.m_introductions[i]).TargetProxy = proxy;
                }
            }
        }
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="info">Serialization data.</param>
 /// <param name="context">Serialization context.</param>
 protected AdvisedProxy(SerializationInfo info, StreamingContext context)
 {
     m_advised = (IAdvised)info.GetValue("advised", typeof(IAdvised));
     m_introductions = (IAdvice[])info.GetValue("introductions", typeof(IAdvice[]));
     m_targetSourceWrapper = (ITargetSourceWrapper)info.GetValue("tsWrapper", typeof(ITargetSourceWrapper));
     m_targetType = (Type)info.GetValue("targetType", typeof(Type));
 }