Ejemplo n.º 1
0
        public CommonTaskHolder FindTask(string key)
        {
            var assemblies = AssemblyLoadContext.Default.Assemblies;

            foreach (var assembly in assemblies)
            {
                foreach (var type in UtilReflection.GetImplementers <CommonTask>(assembly))
                {
                    var attr = UtilReflection.GetAttribute <DescriptorAttribute>(type);
                    if (attr == null)
                    {
                        continue;
                    }
                    if (attr.Key != key)
                    {
                        continue;
                    }

                    var holder = CreateHolder(type, attr);
                    return(holder);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        private void AddTaskTypesFrom(Assembly assembly)
        {
            _logger.LogInformation("Locating types in assembly {0}", assembly.FullName);
            var types = UtilReflection.GetImplementers <CommonTask>(assembly).ToList();

            if (types.Count > 0)
            {
                _taskTypeList.AddRange(types);
            }
        }