Example #1
0
        public static IServiceCollection AddDynamicJobCore(this IServiceCollection collection, Action <DynamicJobConfiguration> configure = null)
        {
            collection
            .AddSingleton <IJobWrapper, JobWrapper>()
            .AddSingleton <IServerJobStorage, ServerJobStorage.ServerJobStorage>()
            .AddSingleton <IJobExecutor, JobExecutor.JobExecutor>();

            //TODO сделать дефолтное хранилище в памяти
            var configuration = new DynamicJobConfiguration();

            configure?.Invoke(configuration);
            collection.AddSingleton(configuration);

            return(collection);
        }
Example #2
0
 public JobWrapper(IServerJobStorage serverJobStorage, IJobExecutor jobExecutor, DynamicJobConfiguration configuration)
 {
     _serverJobStorage = serverJobStorage;
     _jobExecutor      = jobExecutor;
     _configuration    = configuration;
 }