private static void ConfigureBotActions(Assembly applicationAssembly, IServiceCollection services) { services.AddScoped <ActionExecutor>(); var typesWithAttribute = applicationAssembly.GetExportedTypes() .Where(x => x.GetCustomAttribute(typeof(BotActionAttribute)) != null); foreach (var type in typesWithAttribute) { var att = type.GetCustomAttribute <BotActionAttribute>(); services.AddTransient(type); if (att.IsCommon) { ActionExecutor.AddUnnamedAction(type); } else { ActionExecutor.AddAction(att.Action, type); } } ActionExecutor.RegisterEvents(applicationAssembly, services); }