diff --git a/delete-bin-obj-folders.bat b/delete-bin-obj-folders.bat
new file mode 100644
index 0000000..cf0d6ef
--- /dev/null
+++ b/delete-bin-obj-folders.bat
@@ -0,0 +1,20 @@
+@ECHO off
+cls
+
+ECHO Deleting all BIN and OBJ folders...
+ECHO.
+
+FOR /d /r . %%d in (bin,obj,LocalNuget) DO (
+ IF EXIST "%%d" (
+ ECHO %%d | FIND /I "\node_modules\" > Nul && (
+ ECHO.Skipping: %%d
+ ) || (
+ ECHO.Deleting: %%d
+ rd /s/q "%%d"
+ )
+ )
+)
+
+ECHO.
+ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
+pause > nul
\ No newline at end of file
diff --git a/sample/DemoScheduler.cs b/sample/DemoScheduler.cs
index ce4ba2c..af1c835 100644
--- a/sample/DemoScheduler.cs
+++ b/sample/DemoScheduler.cs
@@ -17,9 +17,9 @@ public static class DemoScheduler
/// How to compatible old code to SilkierQuartz
///
///
- public static void SchedulerJobs(this IApplicationBuilder app)
+ public static void SchedulerJobs(this IApplicationBuilder app)
{
- IScheduler scheduler = app.GetScheduler();
+ var scheduler = app.GetScheduler();
{
var jobData = new JobDataMap();
jobData.Put("DateFrom", DateTime.Now);
@@ -127,7 +127,7 @@ public static void SchedulerJobs(this IApplicationBuilder app)
}
- public class DummyJob : IJob
+ private class DummyJob : IJob
{
private static readonly Random Random = new Random();
diff --git a/sample/Jobs/LongRunningJob.cs b/sample/Jobs/LongRunningJob.cs
new file mode 100644
index 0000000..6c737b4
--- /dev/null
+++ b/sample/Jobs/LongRunningJob.cs
@@ -0,0 +1,21 @@
+锘縰sing Quartz;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SilkierQuartz.Example.Jobs
+{
+ public class LongRunningJob : IJob
+ {
+ public async Task Execute(IJobExecutionContext context)
+ {
+ Console.WriteLine("Long Started");
+ await Task.Delay(30000);//half min
+ Console.WriteLine("Long Running");
+ await Task.Delay(30000);//half min
+ Console.WriteLine("Long Complete");
+ await Task.CompletedTask;
+ }
+ }
+}
diff --git a/sample/Program.cs b/sample/Program.cs
index bb2453d..34d0e56 100644
--- a/sample/Program.cs
+++ b/sample/Program.cs
@@ -18,7 +18,7 @@ public static void Main(string[] args)
CreateHostBuilder(args).Build().Run();
}
- public static IHostBuilder CreateHostBuilder(string[] args) =>
+ private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
diff --git a/sample/Startup.cs b/sample/Startup.cs
index 1403366..1c3c173 100644
--- a/sample/Startup.cs
+++ b/sample/Startup.cs
@@ -1,3 +1,4 @@
+using System;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -17,7 +18,7 @@ public Startup(IConfiguration configuration)
Configuration = configuration;
}
- public IConfiguration Configuration { get; }
+ private IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
@@ -59,7 +60,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddQuartzJob()
.AddQuartzJob()
.AddQuartzJob()
- .AddQuartzJob();
+ .AddQuartzJob()
+ .AddQuartzJob();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -85,11 +87,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
endpoints.MapRazorPages();
});
//How to compatible old code to SilkierQuartz
- //将旧的原来的规划Job的代码进行移植兼容的示例
+ //灏嗘棫鐨勫師鏉ョ殑瑙勫垝Job鐨勪唬鐮佽繘琛岀Щ妞嶅吋瀹圭殑绀轰緥
// app.SchedulerJobs();
- #region 不使用 SilkierQuartzAttribe 属性的进行注册和使用的IJob,这里通过UseQuartzJob的IJob必须在 ConfigureServices进行AddQuartzJob
+ #region 涓嶄娇鐢 SilkierQuartzAttribe 灞炴х殑杩涜娉ㄥ唽鍜屼娇鐢ㄧ殑IJob锛岃繖閲岄氳繃UseQuartzJob鐨処Job蹇呴』鍦 ConfigureServices杩涜AddQuartzJob
app.UseQuartzJob(TriggerBuilder.Create().WithSimpleSchedule(x => x.WithIntervalInSeconds(1).RepeatForever()))
.UseQuartzJob(() =>
@@ -108,6 +110,17 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
TriggerBuilder.Create()
.WithCronSchedule("0 0 2 ? * 7 *"),
});
+ var runAt = DateTime.Now.AddMinutes(3);
+ app.UseQuartzJob(new List
+ {
+ TriggerBuilder.Create()
+ .WithSimpleSchedule(x => x.WithIntervalInMinutes(1).RepeatForever()),
+ TriggerBuilder.Create()
+ .WithSimpleSchedule(x => x.WithIntervalInMinutes(2).RepeatForever()),
+ //Add a sample that uses 1-7 for dow
+ TriggerBuilder.Create()
+ .WithCronSchedule($"0 {runAt.Minute} {runAt.Hour} ? * {(int)runAt.DayOfWeek} *"),
+ });
app.UseQuartzJob(() =>
{
diff --git a/sample/example.csproj b/sample/example.csproj
index 56d07f2..3d1b569 100644
--- a/sample/example.csproj
+++ b/sample/example.csproj
@@ -1,7 +1,7 @@
锘
- net6.0
+ net8.0
diff --git a/sample2/DemoScheduler.cs b/sample2/DemoScheduler.cs
index ce4ba2c..5b757ee 100644
--- a/sample2/DemoScheduler.cs
+++ b/sample2/DemoScheduler.cs
@@ -19,7 +19,7 @@ public static class DemoScheduler
///
public static void SchedulerJobs(this IApplicationBuilder app)
{
- IScheduler scheduler = app.GetScheduler();
+ var scheduler = app.GetScheduler();
{
var jobData = new JobDataMap();
jobData.Put("DateFrom", DateTime.Now);
diff --git a/sample2/Jobs/LongRunningJob.cs b/sample2/Jobs/LongRunningJob.cs
new file mode 100644
index 0000000..6c737b4
--- /dev/null
+++ b/sample2/Jobs/LongRunningJob.cs
@@ -0,0 +1,21 @@
+锘縰sing Quartz;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SilkierQuartz.Example.Jobs
+{
+ public class LongRunningJob : IJob
+ {
+ public async Task Execute(IJobExecutionContext context)
+ {
+ Console.WriteLine("Long Started");
+ await Task.Delay(30000);//half min
+ Console.WriteLine("Long Running");
+ await Task.Delay(30000);//half min
+ Console.WriteLine("Long Complete");
+ await Task.CompletedTask;
+ }
+ }
+}
diff --git a/sample2/Program.cs b/sample2/Program.cs
index 1e2a391..3084488 100644
--- a/sample2/Program.cs
+++ b/sample2/Program.cs
@@ -21,7 +21,7 @@
builder.Services.AddRazorPages();
var services = builder.Services;
-var Configuration =builder.Configuration;
+var configuration = builder.Configuration;
services.AddSilkierQuartz(options =>
{
options.VirtualPathRoot = "/quartz";
@@ -53,12 +53,13 @@
#endif
);
services.AddOptions();
-services.Configure(Configuration);
+services.Configure(configuration);
services.Configure(options => { options.WriteText = "This is inject string"; });
services.AddQuartzJob()
.AddQuartzJob()
.AddQuartzJob()
- .AddQuartzJob();
+ .AddQuartzJob()
+ .AddQuartzJob();
var app = builder.Build();
@@ -84,7 +85,7 @@
app.UseAuthorization();
app.UseSilkierQuartz();
app.MapRazorPages();
-#region 不使用 SilkierQuartzAttribe 属性的进行注册和使用的IJob,这里通过UseQuartzJob的IJob必须在 ConfigureServices进行AddQuartzJob
+#region 涓嶄娇鐢 SilkierQuartzAttribe 灞炴х殑杩涜娉ㄥ唽鍜屼娇鐢ㄧ殑IJob锛岃繖閲岄氳繃UseQuartzJob鐨処Job蹇呴』鍦 ConfigureServices杩涜AddQuartzJob
app.UseQuartzJob(TriggerBuilder.Create().WithSimpleSchedule(x => x.WithIntervalInSeconds(1).RepeatForever()))
.UseQuartzJob(() =>
@@ -103,6 +104,17 @@
TriggerBuilder.Create()
.WithCronSchedule("0 0 2 ? * 7 *"),
});
+var runAt = DateTime.Now.AddMinutes(3);
+app.UseQuartzJob(new List
+ {
+ TriggerBuilder.Create()
+ .WithSimpleSchedule(x => x.WithIntervalInMinutes(1).RepeatForever()),
+ TriggerBuilder.Create()
+ .WithSimpleSchedule(x => x.WithIntervalInMinutes(2).RepeatForever()),
+ //Add a sample that uses 1-7 for dow
+ TriggerBuilder.Create()
+ .WithCronSchedule($"0 {runAt.Minute} {runAt.Hour} ? * {(int)runAt.DayOfWeek} *"),
+ });
app.UseQuartzJob(() =>
{
@@ -113,4 +125,4 @@
});
#endregion
-app.Run();
+app.Run();
\ No newline at end of file
diff --git a/sample2/sample2.csproj b/sample2/sample2.csproj
index 6e0e75f..269c39c 100644
--- a/sample2/sample2.csproj
+++ b/sample2/sample2.csproj
@@ -1,23 +1,23 @@
-
- net6.0
- enable
- enable
- aspnet-WebApplication1-A527D1EB-9052-4CB4-84DF-96A390FE8CC1
-
+
+ net8.0
+ enable
+ enable
+ aspnet-WebApplication1-A527D1EB-9052-4CB4-84DF-96A390FE8CC1
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/src/Quartz.Plugins.RecentHistory/IExecutionHistoryStore.cs b/src/Quartz.Plugins.RecentHistory/IExecutionHistoryStore.cs
index 5933207..5379c15 100644
--- a/src/Quartz.Plugins.RecentHistory/IExecutionHistoryStore.cs
+++ b/src/Quartz.Plugins.RecentHistory/IExecutionHistoryStore.cs
@@ -12,11 +12,11 @@ public class ExecutionHistoryEntry
public string SchedulerName { get; set; }
public string Job { get; set; }
public string Trigger { get; set; }
- public DateTime? ScheduledFireTimeUtc { get; set; }
- public DateTime ActualFireTimeUtc { get; set; }
+ public DateTimeOffset? ScheduledFireTimeUtc { get; set; }
+ public DateTimeOffset ActualFireTimeUtc { get; set; }
public bool Recovering { get; set; }
public bool Vetoed { get; set; }
- public DateTime? FinishedTimeUtc { get; set; }
+ public DateTimeOffset? FinishedTimeUtc { get; set; }
public string ExceptionMessage { get; set; }
}
diff --git a/src/Quartz.Plugins.RecentHistory/Quartz.Plugins.RecentHistory.csproj b/src/Quartz.Plugins.RecentHistory/Quartz.Plugins.RecentHistory.csproj
index 1639ed0..77340fb 100644
--- a/src/Quartz.Plugins.RecentHistory/Quartz.Plugins.RecentHistory.csproj
+++ b/src/Quartz.Plugins.RecentHistory/Quartz.Plugins.RecentHistory.csproj
@@ -1,40 +1,39 @@
锘
+
+ net8.0
+ PackageReference
+ true
+ true
+ 1591
-
- net6.0
- PackageReference
- true
- true
- 1591
+ 8.0.1
+ SilkierQuartz
+ Quartz.NET plugin to persist recent job execution history
+ Jan Lucansky,Maikebing
+ https://github.com/jlucansky/SilkierQuartz
+ This is supporting package for SilkierQuartz
+ quartz;recent;history
+ 1.0.0.0
+ 1.0.0.0
+ LICENSE
+ Copyright 漏 2018 Jan Lucansky, Copyright 漏 2020 Maikebing
+ git
+ https://github.com/jlucansky/SilkierQuartz
+ SilkierQuartz.Plugins.RecentHistory
+ true
+
- 1.0.3
- SilkierQuartz
- Quartz.NET plugin to persist recent job execution history
- Jan Lucansky,Maikebing
- https://github.com/jlucansky/SilkierQuartz
- This is supporting package for SilkierQuartz
- quartz;recent;history
- 1.0.0.0
- 1.0.0.0
- LICENSE
- Copyright 漏 2018 Jan Lucansky, Copyright 漏 2020 Maikebing
- git
- https://github.com/jlucansky/SilkierQuartz
- SilkierQuartz.Plugins.RecentHistory
- true
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
diff --git a/src/SilkierQuartz/Controllers/CalendarsController.cs b/src/SilkierQuartz/Controllers/CalendarsController.cs
index 1fd60d1..d616002 100644
--- a/src/SilkierQuartz/Controllers/CalendarsController.cs
+++ b/src/SilkierQuartz/Controllers/CalendarsController.cs
@@ -20,7 +20,7 @@ public async Task Index()
var list = new List();
- foreach (string name in calendarNames)
+ foreach (var name in calendarNames)
{
var cal = await Scheduler.GetCalendar(name);
list.Add(new CalendarListItem() { Name = name, Description = cal.Description, Type = cal.GetType() });
@@ -73,7 +73,7 @@ public async Task Save([FromBody] CalendarViewModel[] chain, bool
if (chain.Length == 0 || string.IsNullOrEmpty(chain[0].Name))
result.Errors.Add(ValidationError.EmptyField(nameof(CalendarViewModel.Name)));
- for (int i = 0; i < chain.Length; i++)
+ for (var i = 0; i < chain.Length; i++)
{
RemoveLastEmpty(chain[i].Days);
RemoveLastEmpty(chain[i].Dates);
@@ -86,7 +86,7 @@ public async Task Save([FromBody] CalendarViewModel[] chain, bool
if (result.Success)
{
- string name = chain[0].Name;
+ var name = chain[0].Name;
ICalendar existing = null;
@@ -94,9 +94,9 @@ public async Task Save([FromBody] CalendarViewModel[] chain, bool
existing = await Scheduler.GetCalendar(name);
ICalendar root = null, current = null;
- for (int i = 0; i < chain.Length; i++)
+ for (var i = 0; i < chain.Length; i++)
{
- ICalendar newCal = chain[i].Type.Equals("custom") ? existing : chain[i].BuildCalendar();
+ var newCal = chain[i].Type.Equals("custom") ? existing : chain[i].BuildCalendar();
if (newCal == null)
break;
diff --git a/src/SilkierQuartz/Controllers/HistoryController.cs b/src/SilkierQuartz/Controllers/HistoryController.cs
index 30f177a..181de0f 100644
--- a/src/SilkierQuartz/Controllers/HistoryController.cs
+++ b/src/SilkierQuartz/Controllers/HistoryController.cs
@@ -21,7 +21,7 @@ public async Task Index()
if (store == null)
return View(null);
- IEnumerable history = await store.FilterLast(100);
+ var history = await store.FilterLast(100);
var list = new List