コード例 #1
0
        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);
        }
コード例 #2
0
 public TaskLocator(
     IServiceLocator serviceLocator,
     TaskTypeLocator consoleTaskTypeLocator,
     ITaskFrequencyManager taskFrequencyManager
     )
 {
     _serviceLocator         = serviceLocator;
     _consoleTaskTypeLocator = consoleTaskTypeLocator;
     _taskFrequencyManager   = taskFrequencyManager;
 }
コード例 #3
0
 public TaskInjector(TaskTypeLocator consoleTaskTypeLocator)
 {
     _consoleTaskTypeLocator = consoleTaskTypeLocator;
 }