public static Resolver UseReflectionType(this Resolver resolver, Action <ReflectionTypeResolver> configure)
 {
     return(resolver.Use(r =>
     {
         var rr = new ReflectionTypeResolver();
         configure(rr);
         return rr;
     }));
 }
Exemple #2
0
        private BackgroundTaskHost CreateBackgroundTaskHost(Action <BackgroundTaskOptions> configureOptions)
        {
            var services = new ServiceCollection();

            services.AddBackgroundTasks(configureOptions);

            var serviceProvider = services.BuildServiceProvider();

            var serializer   = new JsonBackgroundTaskSerializer();
            var typeResolver = new ReflectionTypeResolver();
            var options      = serviceProvider.GetRequiredService <IOptionsMonitor <BackgroundTaskOptions> >();
            var host         = serviceProvider.GetService <ISafeLogger <BackgroundTaskHost> >();

            var scheduler = new BackgroundTaskHost(serviceProvider, Store, serializer, typeResolver, options, host);

            return(scheduler);
        }