private static void CreateInstance() { lock (lockObj) { if (instance == null) { instance = new ProxyFactory(); } } }
///<summary> /// Factory method to create a new proxy instance. ///</summary> ///<param name="interceptors">List of interceptors to be called before the actual method gets executed.</param> ///<param name="aditionalInterfaces">Aditional interfaces to be implemented by the proxy instance.</param> internal static object NewInstance <TInterface>(IInterceptor[] interceptors = null, Type[] aditionalInterfaces = null) { return(ProxyFactory.GetInstance().Create(new DynamicProxy(null, interceptors), typeof(TInterface), aditionalInterfaces)); }
///<summary> /// Factory method to create a new proxy instance. ///</summary> ///<param name="objectInstance">Instance of object to be proxied</param> ///<param name="interceptors">List of interceptors to be called before the actual method gets executed.</param> ///<param name="aditionalInterfaces">Aditional interfaces to be implemented by the proxy instance.</param> internal static object NewInstance(object objectInstance, IInterceptor[] interceptors = null, Type[] aditionalInterfaces = null) { return(ProxyFactory.GetInstance().Create(new DynamicProxy(objectInstance, interceptors), objectInstance.GetType(), aditionalInterfaces)); }