public void FindHandlers() { var finder = new HandlerFinder(); var handlers = finder.FindHandlers(typeof(TestHandler)); Assert.AreEqual(2, handlers.Count()); }
//private readonly IRepository repository; public ExecuteHandler( HandlerFinder handlerTypes, IFactory factory, IPageMapper mapper) { this.handlerTypes = handlerTypes; this.factory = factory; this.mapper = mapper; }
public MessageBus( HandlerFinder handlerTypes, IFactory factory, IPageMapper mapper ) { this.handlerTypes = handlerTypes; this.factory = factory; this.mapper = mapper; }
//private readonly IRepository repository; public MessageBus( HandlerFinder handlerTypes, IFactory factory, INewMapper mapper //IRepository repository, //IClaimsProvider authenticator ) { this.handlerTypes = handlerTypes; this.factory = factory; this.mapper = mapper; //this.authenticator = authenticator; }
//public static IRouteBuilder MapVerb(this IRouteBuilder builder, string verb, string template, Action<IApplicationBuilder> action); public static IApplicationBuilder AddHandlers(this IApplicationBuilder app, System.Reflection.Assembly asm) { // System.Collections.Generic.List<System.Type> ls = HandlerFinder.FindDerivedTypes( // asm, typeof(CoreCMS.HandlerMiddleware<>), typeof(CoreCMS.IHttpHandler) // ); System.Collections.Generic.List <System.Type> ls = HandlerFinder.GetTypesWithAttribute <HandlerPathAttribute>(asm); foreach (System.Type t in ls) { app.MapVerbs(t); } return(app); }