Exemple #1
0
        /// <summary>
        /// 假删除,根据表达示
        /// 使用说明::
        /// FalseDelete《T》(new int[]{1,2,3})或者Delete《T》(3)
        /// </summary>
        /// <param name="field">更新删除状态字段</param>
        /// <param name="expression">筛选表达示</param>
        public bool FalseDelete <T>(string field, System.Linq.Expressions.Expression <Func <T, bool> > expression)
        {
            var tasks = new Task <bool> [configList.Count];

            for (int i = 0; i < tasks.Length; i++)
            {
                CloudPubMethod.TaskFactory <bool>(ti =>
                {
                    var connName = configList[ti].ConnectionString;
                    var db       = new SqlSugarClient(connName);
                    SettingConnection(db);
                    return(db.FalseDelete <T>(field, expression));
                }, tasks, i);
            }
            Task.WaitAll(tasks);
            return(tasks.Any(it => it.Result));
        }
Exemple #2
0
        /// <summary>
        /// 批量删除
        /// 注意:whereIn 主键集合
        /// 使用说明:Delete《T》(new int[]{1,2,3}) 或者  Delete《T》(3)
        /// </summary>
        /// <param name="whereIn"> delete ids </param>
        public bool FalseDelete <T, FiledType>(string field, params FiledType[] whereIn)
        {
            var tasks = new Task <bool> [configList.Count];

            for (int i = 0; i < tasks.Length; i++)
            {
                CloudPubMethod.TaskFactory <bool>(ti =>
                {
                    var connName = configList[ti].ConnectionString;
                    var db       = new SqlSugarClient(connName);
                    SettingConnection(db);;
                    return(db.FalseDelete <T, FiledType>(field, whereIn));
                }, tasks, i);
            }
            Task.WaitAll(tasks);
            return(tasks.Any(it => it.Result));
        }