Skip to content

Commit

Permalink
优化AddJobAndJobFactory扩展方法生命周期;
Browse files Browse the repository at this point in the history
  • Loading branch information
zqlovejyc committed Aug 22, 2020
1 parent fb7d515 commit bbd9ce6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ZqUtils.Core/Extensions/Extensions.Quartz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public static class QuartzExtensions
/// </summary>
/// <param name="this"></param>
/// <param name="filter">Assembly过滤器</param>
/// <param name="lifetime">生命周期,默认:单例</param>
/// <param name="lifetime">生命周期</param>
/// <returns></returns>
public static IServiceCollection AddJobAndJobFactory(
this IServiceCollection @this,
Func<string, bool> filter = null,
ServiceLifetime lifetime = ServiceLifetime.Singleton)
ServiceLifetime lifetime = ServiceLifetime.Transient)
{
//扫描程序集
var assemblies = PathHelper.GetAssemblies(filter: filter).ToList();
Expand All @@ -64,7 +64,7 @@ public static IServiceCollection AddJobAndJobFactory(
.AddClasses(classes => classes.AssignableTo<IJobFactory>())
.AsImplementedInterfaces()
.AsSelf()
.WithLifetime(lifetime)
.WithSingletonLifetime()
.AddClasses(classes => classes.AssignableTo<IJob>())
.AsImplementedInterfaces()
.AsSelf()
Expand Down

0 comments on commit bbd9ce6

Please sign in to comment.