Пример #1
0
 /// <summary>
 /// 初始化数据库表
 /// </summary>
 /// <returns></returns>
 private async Task InitDBTableAsync()
 {
     //如果不存在sqlite数据库,则创建
     //TODO 其他数据源...
     if (driverDelegateType.Equals(typeof(SQLiteDelegate).AssemblyQualifiedName) ||
         driverDelegateType.Equals(typeof(MySQLDelegate).AssemblyQualifiedName) ||
         driverDelegateType.Equals(typeof(PostgreSQLDelegate).AssemblyQualifiedName))
     {
         IRepositorie repositorie = RepositorieFactory.CreateRepositorie(driverDelegateType, dbProvider);
         await repositorie?.InitTable();
     }
 }
Пример #2
0
        /// <summary>
        /// 移除异常信息
        /// 因为只能在IJob持久化操作JobDataMap,所有这里直接暴力操作数据库。
        /// </summary>
        /// <param name="jobGroup"></param>
        /// <param name="jobName"></param>
        /// <returns></returns>
        public async Task <bool> RemoveErrLog(string jobGroup, string jobName)
        {
            IRepositorie logRepositorie = RepositorieFactory.CreateRepositorie(driverDelegateType, dbProvider);

            if (logRepositorie == null)
            {
                return(false);
            }

            await logRepositorie.RemoveErrLogAsync(jobGroup, jobName);

            var jobKey    = new JobKey(jobName, jobGroup);
            var jobDetail = await scheduler.GetJobDetail(jobKey);

            jobDetail.JobDataMap[Constant.EXCEPTION] = string.Empty;

            return(true);
        }