private static void RegisterListeners(IActionContainerRegistrationService registrationService, Assembly assembly) { registrationService.Register(typeof(DefaultActionListener), typeof(IActionListener)); var types = assembly .GetTypes() .Where(t => typeof(IActionListener).IsAssignableFrom(t)); foreach (var type in types) { registrationService.Register(type, typeof(IActionListener)); } }
private void RegisterProvidersAndDescriptors(IActionContainerRegistrationService registrationService, Assembly assembly) { var types = assembly .GetTypes() .Where(t => typeof(IActionProvider).IsAssignableFrom(t)); var methodDescriptors = types.SelectMany(t => { var key = Guid.NewGuid().ToString(); registrationService.Register(t, typeof(IActionProvider), key); var actionDescriptors = DescriptorsFromType(t, key); return(actionDescriptors); }).ToList(); registrationService.RegisterInstance(methodDescriptors, typeof(IEnumerable <MethodDescriptor>), "MethodDescriptors"); }