如何在ASP.NET Core 2.0中的特定时间每天重置值

时间:2017-12-15 13:36:02

标签: c# asp.net entity-framework

我有作用域服务ApplicationDbContext。 在这个DbContext中,我有用户档案,它保存了今天的用户培训进度

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
    public DbSet<Profile> Profile { get; set; }
    public DbSet<TrainingProgress> TrainingProgresses { get; set; }
    public DbSet<TrainingSchedule> TrainingSchedules { get; set; }

    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        // Customize the ASP.NET Identity model and override the defaults if needed.
        // For example, you can rename the ASP.NET Identity table names and more.
        // Add your customizations after calling base.OnModelCreating(builder);
    }

}

我希望每天23:59重置此DbContext中的Profile.TodayStepCount值。 我在单例服务中没有ApplicationDbContext的实例。(?) 在这种情况下如何运行计划任务?

允许您执行任务计划的所有库都无法执行。 我尝试过Quartz.NET,FluentScheduler,Hangfire。

0 个答案:

没有答案