/// <summary>
 /// 添加一个任务
 /// </summary>
 /// <param name="task">任务对象</param>
 /// <returns>返回是否添加成功</returns>
 public bool Add(TaskInvokerStorageEntity task)
 {
     return(this._db.Insert(this._tbName, new
     {
         parentId = task.ParentId,
         script = task.Script,
         taskId = task.TaskId,
         url = task.Url,
     }) > 0);
 }
        /// <summary>
        /// 添加任务的最上层执行者,如果存在,不继续添加
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public bool AddRoot(TaskInvokerStorageEntity task)
        {
            var taskInfo = this.Get(new { taskId = task.TaskId });

            if (taskInfo != null)
            {
                return(true);
            }
            return(this.Add(task));
        }
 /// <summary>
 /// 更新任务状态
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool Update(TaskInvokerStorageEntity entity)
 {
     try
     {
         return(this._db.Update(this._tbName, new
         {
             id = entity.Id
         }, entity) == 1);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex);
         // todo: 写日志
     }
     return(false);
 }