增加定时任务,
This commit is contained in:
1 parent
be1fc11e07
commit
be08510a84
10 files changed
+171
-8
No files matched your search
@@ -0,0 +1,15 @@
|
||||
using Hangfire;
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Web.Http.Dependencies;
|
||||
|
||||
namespace Store.Framework.Jobs;
|
||||
|
||||
public class ContainerJobActivator : JobActivator
|
||||
{
|
||||
private readonly IDependencyResolver _provider;
|
||||
public ContainerJobActivator(IDependencyResolver provider) => _provider = provider;
|
||||
|
||||
public override object ActivateJob(Type jobType)
|
||||
=> _provider.GetService(jobType);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Store.Framework.Jobs;
|
||||
|
||||
public interface IScheduledJobs
|
||||
{
|
||||
Task RunAsync();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Store.Framework.Jobs;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class JobAttribute : Attribute
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Cron { get; }
|
||||
|
||||
public JobAttribute(string name, string cron)
|
||||
{
|
||||
Name = name;
|
||||
Cron = cron;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user