public static IDataReader NewInstance(IDataReader dataReader) { IInterceptor handler = new IDataReaderProxy(dataReader); object proxyDataReader = new ProxyGenerator().CreateProxy(typeof(IDataReader), handler, dataReader); return((IDataReader)proxyDataReader); }
/// <summary> /// /// </summary> /// <param name="invocation"></param> /// <param name="arguments"></param> /// <returns></returns> public object Intercept(IInvocation invocation, params object[] arguments) { object returnValue = invocation.Method.Invoke(_command, arguments); if (invocation.Method.Name == "ExecuteReader") { if (_dataReaderLogger.IsDebugEnabled) { returnValue = IDataReaderProxy.NewInstance((IDataReader)returnValue); } } return(returnValue); }
public static IDataReader NewInstance(IDataReader dataReader) { IInterceptor handler = new IDataReaderProxy(dataReader); object proxyDataReader = new ProxyGenerator().CreateProxy(typeof(IDataReader), handler, dataReader); return (IDataReader)proxyDataReader; }