/// <summary> /// Generates a proxy implementing all the specified interfaces and /// redirecting method invocations to the specifed interceptor. /// </summary> /// <param name="interfaces">Array of interfaces to be implemented</param> /// <param name="interceptor">instance of <see cref="IInterceptor"/></param> /// <param name="target">The target object.</param> /// <returns>Proxy instance</returns> public override object CreateProxy(Type[] interfaces, IInterceptor interceptor, object target) { try { System.Type proxyType = null; System.Type targetType = target.GetType(); lock (_cachedProxyTypes.SyncRoot) { proxyType = _cachedProxyTypes[targetType] as System.Type; if (proxyType == null) { proxyType = ProxyBuilder.CreateInterfaceProxy(interfaces, targetType); _cachedProxyTypes[targetType] = proxyType; } } return(base.CreateProxyInstance(proxyType, interceptor, target)); } catch (Exception e) { _log.Error("Castle Dynamic Proxy Generator failed", e); throw new IBatisException("Castle Proxy Generator failed", e); } }