public static JobOptions GetDefaults(Type jobType) { var jobOptions = new JobOptions(); ApplyDefaults(jobOptions, jobType); return(jobOptions); }
public static JobOptions GetDefaults(Type jobType) { var jobOptions = new JobOptions(); var jobAttribute = jobType.GetCustomAttribute <JobAttribute>() ?? new JobAttribute(); jobOptions.Name = jobAttribute.Name; if (String.IsNullOrEmpty(jobOptions.Name)) { string jobName = jobType.Name; if (jobName.EndsWith("Job")) { jobName = jobName.Substring(0, jobName.Length - 3); } jobOptions.Name = jobName.ToLower(); } jobOptions.Description = jobAttribute.Description; jobOptions.RunContinuous = jobAttribute.IsContinuous; if (!String.IsNullOrEmpty(jobAttribute.Interval)) { TimeSpan?interval; if (TimeUnit.TryParse(jobAttribute.Interval, out interval)) { jobOptions.Interval = interval; } } if (!String.IsNullOrEmpty(jobAttribute.InitialDelay)) { TimeSpan?delay; if (TimeUnit.TryParse(jobAttribute.InitialDelay, out delay)) { jobOptions.InitialDelay = delay; } } jobOptions.IterationLimit = jobAttribute.IterationLimit; jobOptions.InstanceCount = jobAttribute.InstanceCount; return(jobOptions); }
public JobRunner(JobOptions options, ILoggerFactory loggerFactory = null) { _logger = loggerFactory?.CreateLogger <JobRunner>() ?? NullLogger <JobRunner> .Instance; _options = options; }
public JobRunner(JobOptions options, ILoggerFactory loggerFactory = null) { _logger = loggerFactory.CreateLogger<JobRunner>(); _options = options; }
public JobRunner(JobOptions options, ILoggerFactory loggerFactory = null) { _logger = loggerFactory.CreateLogger <JobRunner>(); _options = options; }
public static void ApplyDefaults <T>(this JobOptions jobOptions) { JobOptions.ApplyDefaults(jobOptions, typeof(T)); }