Пример #1
0
 /// <summary>
 ///     Links component to usage of T proxy
 /// </summary>
 public Component Proxy(Type t)
 {
     //checking of type t: it should implement IProxy
     Guard.IsAssignableFrom(typeof(IProxy), t);
     _proxyType = t;
     //if proxy called and component isn't registered for interception, try to register it in default interceptor
     if (InterceptionContext.GetInterceptor(InterfaceType) == null)
     {
         InterceptionContext.GetInterceptor().Register(InterfaceType, this);
     }
     return(this);
 }
Пример #2
0
        /// <summary> Links component to usage of T proxy. </summary>
        public Component WithProxy(Type t)
        {
            // NOTE this check is added to support empty ProxyGen implementation
            // for platforms which don't support System.Reflection.Emit (e.g. web player)
            if (t == null)
            {
                return(this);
            }

            //checking of type t: it should implement IProxy
            Guard.IsAssignableFrom(typeof(IProxy), t);
            _proxyType = t;
            //if proxy called and component isn't registered for interception, try to register it in default interceptor
            if (InterceptionContext.GetInterceptor(InterfaceType) == null)
            {
                InterceptionContext.GetInterceptor().Register(InterfaceType, this);
            }
            return(this);
        }