File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/BlazorAdmin/BlazorAdmin.Core/Data Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1919using Quartz ;
2020using CrystalQuartz . Application ;
2121using BlazorAdmin . Core . Services ;
22+ using System . Reflection ;
2223
2324namespace BlazorAdmin . Core . Data
2425{
@@ -66,10 +67,15 @@ public static void InitialDatabase(this WebApplication app)
6667 app . UseCrystalQuartz ( ( ) => app . Services . GetRequiredService < ISchedulerFactory > ( ) . GetScheduler ( ) ,
6768 new CrystalQuartzOptions
6869 {
69- AllowedJobTypes = new [ ]
70- {
71- typeof ( TestJob )
72- }
70+ AllowedJobTypes = Assembly . GetEntryAssembly ( ) ?
71+ . GetReferencedAssemblies ( )
72+ . SelectMany ( a => Assembly . Load ( a ) . GetExportedTypes ( ) )
73+ . Where ( x =>
74+ x . IsPublic &&
75+ x . IsClass &&
76+ ! x . IsAbstract &&
77+ typeof ( IJob ) . IsAssignableFrom ( x ) )
78+ . ToArray ( ) ?? new Type [ 0 ] ,
7379 } ) ;
7480 }
7581 }
You can’t perform that action at this time.
0 commit comments