|  | @@ -17,12 +17,23 @@ public static class TaskSchedulerServiceExtensions
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="services"></param>
 | 
	
		
			
				|  |  |      /// <param name="configureOptions"></param>
 | 
	
		
			
				|  |  | -    public static void AddTaskScheduler(this IServiceCollection services, Action<TaskSchedulerOptions> configureOptions = null)
 | 
	
		
			
				|  |  | +    public static IServiceCollection AddTaskScheduler(this IServiceCollection services, Action<TaskSchedulerOptions> configureOptions = null)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        return services.AddTaskScheduler(DbKeys.AppDb, configureOptions);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /// <summary>
 | 
	
		
			
				|  |  | +    /// 添加任务调度
 | 
	
		
			
				|  |  | +    /// </summary>
 | 
	
		
			
				|  |  | +    /// <param name="services"></param>
 | 
	
		
			
				|  |  | +    /// <param name="dbKey"></param>
 | 
	
		
			
				|  |  | +    /// <param name="configureOptions"></param>
 | 
	
		
			
				|  |  | +    public static IServiceCollection AddTaskScheduler(this IServiceCollection services, string dbKey, Action<TaskSchedulerOptions> configureOptions = null)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          ServiceProvider = services.BuildServiceProvider();
 | 
	
		
			
				|  |  |          var options = new TaskSchedulerOptions()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            FreeSql = ServiceProvider.GetService<FreeSqlCloud>().Use(DbKeys.AppDb)
 | 
	
		
			
				|  |  | +            FreeSql = ServiceProvider.GetService<FreeSqlCloud>().Use(dbKey)
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          configureOptions?.Invoke(options);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -62,12 +73,15 @@ public static class TaskSchedulerServiceExtensions
 | 
	
		
			
				|  |  |              //开启任务
 | 
	
		
			
				|  |  |              var scheduler = new Scheduler(options.TaskHandler);
 | 
	
		
			
				|  |  |              services.AddSingleton(scheduler);
 | 
	
		
			
				|  |  | -        } else if  (options.TaskHandler != null && options.CustomTaskHandler != null)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (options.TaskHandler != null && options.CustomTaskHandler != null)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              //开启自定义任务
 | 
	
		
			
				|  |  |              var scheduler = new Scheduler(options.TaskHandler, options.CustomTaskHandler);
 | 
	
		
			
				|  |  |              services.AddSingleton(scheduler);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return services;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 |