mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-16 22:46:37 +08:00
加入任务调度模块
This commit is contained in:
@@ -15,7 +15,6 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
|
||||
if (Appsettings.appBool("Cors_Enabled"))
|
||||
{
|
||||
|
||||
services.AddCors(options => options.AddPolicy("CorsPolicy",//解决跨域问题
|
||||
builder =>
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
{
|
||||
DbContextFactory.MutiDB_Enabled = Appsettings.appBool("MutiDB_Enabled");
|
||||
DataContext.DbSelect = Appsettings.app("DbSelect");
|
||||
DataContext._connStr = Appsettings.app("DbConn", "WriteUrl");
|
||||
services.Configure<DbConnOptions>(Appsettings.appConfiguration("DbConn"));
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Quartz;
|
||||
using Quartz.Impl;
|
||||
using Quartz.Spi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.Core.Quartz;
|
||||
|
||||
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
{
|
||||
/// <summary>
|
||||
/// 启动定时器服务,后台服务
|
||||
/// </summary>
|
||||
public static class QuartzExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用定时器
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection AddQuartzService(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<QuartzInvoker>();
|
||||
services.AddSingleton<IJobFactory, MyQuartzFactory>();
|
||||
services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user