public void Intercept(IInvocation invocation)
        {
            string methodName = invocation.Method.Name;

            Type typeofIDao = typeof(INpiDao <>);
            Type entityType = invocation.Method.DeclaringType.GetInterface(typeofIDao.FullName).GetGenericArguments()[0];


            // todo :对其单例化
            ISqlCommandGenerator  g = NpiServicesCollection.GetService <ISqlServerCommandGenerator>();
            SqlCommandDescription d = g.Generate(invocation.Method, invocation.Arguments);

            DebugLogger.Debug(d.ToString());

            DapperParameters dp = new DapperParameters();

            foreach (var p in d.Parameters)
            {
                dp[p.Key] = p.Value.Value;
            }

            object dbReturnedValue = null;
            object handledValue    = null;

            DebugLogger.Debug("准备执行 Sql");

            switch (d.Type)
            {
            case SqlCommandTypes.Insert:
            case SqlCommandTypes.Update:
            case SqlCommandTypes.Delete:
            {
                var executor = ServicesCollection.GetService <ISqlCommandExecutor>();
                dbReturnedValue = executor.Execute(d.SqlCommand, dp, dbConnectionContext);
            }
            break;

            case SqlCommandTypes.Select:
            {
                var querier = ServicesCollection.GetService <ISqlCommandQuerier>();
                dbReturnedValue = querier.Select(entityType, d.SqlCommand, dp, dbConnectionContext);
            }
            break;

            default:
                break;
            }
            DebugLogger.Debug("Sql 执行完毕,开始处理结果集");
            foreach (var handler in dbReturnValueHandlers)
            {
                if (!handler.CanHandle(invocation.Method, entityType))
                {
                    continue;
                }
                handledValue = handler.Handle(invocation.Method, entityType, dbReturnedValue);
            }
            invocation.ReturnValue = handledValue;
            DebugLogger.Debug("结果集处理完毕");
        }
 static NPIInterceptor()
 {
     dbReturnValueHandlers = ServicesCollection.GetServices <IDbReturnValueHandler>();
 }