Abp.Extension.Background 1.0.0

Package Description

Install-Package Abp.Extension.Background -Version 1.0.0
dotnet add package Abp.Extension.Background --version 1.0.0
<PackageReference Include="Abp.Extension.Background" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Abp.Extension.Background --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Abp.Extension.Background, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Abp.Extension.Background as a Cake Addin
#addin nuget:?package=Abp.Extension.Background&version=1.0.0

// Install Abp.Extension.Background as a Cake Tool
#tool nuget:?package=Abp.Extension.Background&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Abp.Extension.Background

  1. 引用dll
Install-Package Abp.Extension.Background


  1. 添加任务类
public class TestTask : IHTask
    {

        public ILogger Logger { get; set; }
        public TestTask()
        {
            Logger = IocManager.Instance.Resolve<ILogger>();
        }

        public void Run()
        {
            Logger.Debug("测试任务执行.............");
        }

        public string Cron()
        {
            return Hangfire.Cron.Minutely();
        }
    }
  1. 注册任务类
//依赖
[DependsOn(typeof(AbpBackgroundModule))]
//注册
public override void PostInitialize()
        {
            
            var queue = IocManager.Resolve<BackTaskQueue>();
            queue.Add(typeof(TestTask).FullName, typeof(TestTask));

        }

  1. Host项目startUp 启用hangfire
//a. ConfigureServices方法
services.AddHangfire(config =>
            {                
                config.UseMemoryStorage();
            });
//b.Configure方法
app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
            });
app.UseHangfireServer();

app.RunHangfireTask();

Abp.Extension.Background

  1. 引用dll
Install-Package Abp.Extension.Background


  1. 添加任务类
public class TestTask : IHTask
    {

        public ILogger Logger { get; set; }
        public TestTask()
        {
            Logger = IocManager.Instance.Resolve<ILogger>();
        }

        public void Run()
        {
            Logger.Debug("测试任务执行.............");
        }

        public string Cron()
        {
            return Hangfire.Cron.Minutely();
        }
    }
  1. 注册任务类
//依赖
[DependsOn(typeof(AbpBackgroundModule))]
//注册
public override void PostInitialize()
        {
            
            var queue = IocManager.Resolve<BackTaskQueue>();
            queue.Add(typeof(TestTask).FullName, typeof(TestTask));

        }

  1. Host项目startUp 启用hangfire
//a. ConfigureServices方法
services.AddHangfire(config =>
            {                
                config.UseMemoryStorage();
            });
//b.Configure方法
app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
            });
app.UseHangfireServer();

app.RunHangfireTask();

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 856 12/30/2017