Exemple #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);
            }
        }