Exemple #1
0
        protected ProxyBase(object baseObject, IInvocationInterceptor invocationInterceptor)
        {
            CheckConstructorArguments(baseObject, invocationInterceptor);

            this.baseObject            = baseObject;
            this.invocationInterceptor = invocationInterceptor;
        }
Exemple #2
0
        internal static void CheckConstructorArguments(object baseObject, IInvocationInterceptor invocationInterceptor)
        {
            if (baseObject == null)
            {
                throw new ArgumentNullException("baseObject");
            }

            if (invocationInterceptor == null)
            {
                throw new ArgumentNullException("invocationInterceptor");
            }
        }
Exemple #3
0
        public T CreateDelegateProxy <T>(object baseObject, IInvocationInterceptor invocationInterceptor)
        {
            ProxyBase <T> .CheckConstructorArguments(baseObject, invocationInterceptor);

            var delegateType = typeof(T);

            if (!delegateType.IsDelegateType())
            {
                throw new ArgumentException(string.Format("{0} is not an delegate", delegateType));
            }

            var proxyType = proxyTypeCache.GetProxyType(delegateType, CreateProxyTypeForDelegate);

            return((T)CreateDelegate(proxyType, delegateType, baseObject, invocationInterceptor));
        }
Exemple #4
0
        public T CreateInterfaceProxy <T>(object baseObject, IInvocationInterceptor invocationInterceptor)
        {
            ProxyBase <T> .CheckConstructorArguments(baseObject, invocationInterceptor);

            var interfaceType = typeof(T);

            if (!interfaceType.IsInterface)
            {
                throw new ArgumentException(string.Format("{0} is not an interface", interfaceType));
            }

            var proxyType = proxyTypeCache.GetProxyType(interfaceType, CreateProxyTypeForInterface);

            return((T)CreateInstance(proxyType, baseObject, invocationInterceptor));
        }
Exemple #5
0
 public virtual void OnInvocation(IInvocationInterceptor interceptor)
 {
 }
 public Target(object baseObject, IInvocationInterceptor invocationInterceptor)
     : base(baseObject, invocationInterceptor)
 {
 }
 public Target(IInvocationInterceptor invocationInterceptor)
     : base(new object(), invocationInterceptor)
 {
 }