private IEnumerable <RouteMetadata> GetRoutes(IDiscoveryService discovery, Type type) { foreach (RouteMetadata route in discovery.GetRoutes(type)) { route.Factory = route.Factory ?? (() => this.ServiceProvider.GetService(type)); yield return(route); } }