예제 #1
0
        static void addDataToCollection(IDbHelper dbHelper, AutoCall autoCall, Action <object> action, Func <DbCommand, object> func, string sql_1, string tableName_1, List <DbParameter> para_1)
        {
            lock (_addDataToCollection)
            {
                IExecuteSql executeSql = null;
                execSqlDic.TryGetValue(tableName_1, out executeSql);

                if (null == executeSql)
                {
                    executeSql               = ExecuteSql.Instance;
                    executeSql.Key           = tableName_1;
                    executeSql.connectString = dbHelper.connectString;
                    Type type = dbHelper.dataServerProvider.GetType();
                    executeSql.dataServerProvider = (IDataServerProvider)Activator.CreateInstance(type);
                    executeSql.disposableAndClose = dbHelper.disposableAndClose;
                    executeSql.dbConnectionState  = dbHelper.dbConnectionState;
                    execSqlDic.Add(tableName_1, executeSql);
                }

                TempData td = TempData.Instance;
                td.dbHelper    = dbHelper;
                td.autoCall    = autoCall;
                td.sql         = sql_1;
                td.parameters  = para_1;
                td.resultOfOpt = action;
                td.dataOpt     = func;

                executeSql.Add(td);
            }
        }
예제 #2
0
        protected override object InvokeImplement <T>(T oChannel)
        {
            IContext context = ContextManager.Context;

            IExecuteSql channel = oChannel as IExecuteSql;

            if (channel != null)
            {
                channel.Do(context, out returnMsgs, sql);
            }
            return(null);
        }
 /// <summary>
 ///     数据库操作(支持异常SQL日志记录)
 /// </summary>
 /// <param name="db">数据库执行者</param>
 internal ExecuteSqlExceptionLogProxy(IExecuteSql db)
 {
     _dbExecutor = db;
 }
 /// <summary>
 ///     构造函数
 /// </summary>
 /// <param name="db">数据库执行者</param>
 internal ExecuteSqlLogProxy(IExecuteSql db)
 {
     _dbExecutor = db;
 }
 /// <summary>
 ///     将SQL发送到数据库(代理类、记录SQL、执行时间)
 /// </summary>
 /// <param name="db">数据库执行者</param>
 internal ExecuteSqlMonitorProxy(IExecuteSql db)
 {
     _dbExecutor  = db;
     _sqlMonitors = IocManager.Instance.ResolveAll <ISqlMonitor>();
 }