public static ServiceFinder AddTasksInfrastructure(this IServiceCollection services, IConfiguration configuration) { var assemblies = AssemblyLoadContext.Default.Assemblies.Where(a => a.FullName.Contains("Leftware")); var names = assemblies.Select(a => a.FullName).ToList(); foreach (var assembly in assemblies) { LoadReferencedAssembly(assembly); } var logger = CreateLogger(services, configuration); var dynamicLoader = new DynamicAssemblyLoader(configuration); dynamicLoader.Execute(); var taskTypeLocator = new TaskTypeLocator(dynamicLoader, logger); services.AddSingleton(taskTypeLocator); var defaultProvider = new DefaultInjectionProvider(services); services.AddSingleton <IInjectionProvider>(defaultProvider); var finder = new ServiceFinder(defaultProvider, configuration, logger); finder.Find(); var taskInjector = new TaskInjector(taskTypeLocator); taskInjector.Inject(defaultProvider); return(finder); }
public TaskLocator( IServiceLocator serviceLocator, TaskTypeLocator consoleTaskTypeLocator, ITaskFrequencyManager taskFrequencyManager ) { _serviceLocator = serviceLocator; _consoleTaskTypeLocator = consoleTaskTypeLocator; _taskFrequencyManager = taskFrequencyManager; }
public TaskInjector(TaskTypeLocator consoleTaskTypeLocator) { _consoleTaskTypeLocator = consoleTaskTypeLocator; }