public void Scanner_should_find_all_handlers_types() { var handlerTypes = scanner.FindTypes(typeof(IHandle <>)); Assert.Contains(typeof(BarHandler), handlerTypes); Assert.Contains(typeof(FooHandler), handlerTypes); }
private void RegisterMiddlewares() { var assemblyScanner = new AssemblyScanner(); var types = assemblyScanner.FindTypes <IMiddleware>(); foreach (var type in types) { if (type.IsInterface()) { continue; } if (type.ImplementsInterface(typeof(IPreMiddleware))) { Register(typeof(IPreMiddleware), type, type.FullName); continue; } if (type.ImplementsInterface(typeof(ISystemMiddleware))) { Register(typeof(ISystemMiddleware), type, type.FullName); continue; } Register(typeof(IMiddleware), type, type.FullName); } }
private static void ResolveTypes() { var scanner = new AssemblyScanner(); var foundType = scanner.FindTypes<IStartupTask>(); startupTaskTypes.Clear(); startupTaskTypes.AddRange(foundType); }
public void Prime() { var scanner = new AssemblyScanner(); var handlerTypes = scanner.FindTypes(typeof(IHandle<>)); foreach (var handlerType in handlerTypes) { Add(handlerType); } }
private static Type ResolveType(Type type) { var types = assemblyScanner.FindTypes(type); var resolvedType = types.All(x => x.IsLocal()) ? types.LastOrDefault() : types.LastOrDefault(x => !x.IsLocal()); if (resolvedType != null) { return(resolvedType); } throw new Exception($"Unable to resolve type: {type}"); }
public void Prime() { var scanner = new AssemblyScanner(); var handlerTypes = scanner.FindTypes(typeof(IHandle <>)); Clear(); foreach (var handlerType in handlerTypes) { log.Debug($"Found handler {handlerType.Name}"); Add(handlerType); } }
private void RegisterMessageHandlers() { var assemblyScanner = new AssemblyScanner(); var types = assemblyScanner.FindTypes <IMessageHandler>(); foreach (var type in types) { if (type.IsInterface()) { continue; } Register(type, type, type.FullName); } }
private void RegisterShutdownTasks() { var assemblyScanner = new AssemblyScanner(); var types = assemblyScanner.FindTypes <IShutdownTask>(); foreach (var type in types) { if (type.IsInterface()) { continue; } Register(typeof(IShutdownTask), type, type.FullName).As.Singleton(); } }
private static void ResolveTypes() { var scanner = new AssemblyScanner(); var foundType = scanner.FindTypes<IMessageFilter>(); filterTypes.Clear(); filterTypes.AddRange(foundType); }