private void ServiceRouteManager_Add(object sender, ServiceRouteEventArgs e) { var key = GetCacheKey(e.Route.ServiceDescriptor); _concurrent.AddOrUpdate(key, e.Route, (k, v) => e.Route); var httpMethods = e.Route.ServiceDescriptor.HttpMethod(); foreach (var httpMethod in httpMethods) { _serviceRoutes.AddOrUpdate(new Tuple <string, string>(e.Route.ServiceDescriptor.RoutePath, httpMethod), e.Route, (k, v) => e.Route); } }
private void ServiceRouteManager_Removed(object sender, ServiceRouteEventArgs e) { var key = GetCacheKey(e.Route.ServiceDescriptor); _concurrent.TryRemove(key, out ServiceRoute route1); var httpMethods = e.Route.ServiceDescriptor.HttpMethod(); foreach (var httpMethod in httpMethods) { _serviceRoutes.TryRemove(new Tuple <string, string>(e.Route.ServiceDescriptor.RoutePath, httpMethod), out ServiceRoute route2); } }