private static RouteAreaAttribute GetAreaFrom(ReflectedAsyncControllerDescriptor controllerDescriptor) { RouteAreaAttribute areaAttribute = controllerDescriptor.GetCustomAttributes(typeof(RouteAreaAttribute), true) .Cast<RouteAreaAttribute>() .FirstOrDefault(); return areaAttribute; }
private static string GetPrefixFrom(ReflectedAsyncControllerDescriptor controllerDescriptor) { // this only happens once per controller type, for the lifetime of the application, // so we do not need to cache the results object[] routePrefixAttributes = controllerDescriptor.GetCustomAttributes(typeof(RoutePrefixAttribute), inherit: false); if (routePrefixAttributes.Length > 0) { RoutePrefixAttribute routePrefixAttribute = routePrefixAttributes[0] as RoutePrefixAttribute; if (routePrefixAttribute != null) { return routePrefixAttribute.Prefix; } } return null; }
private static RoutePrefixAttribute GetPrefixFrom(ReflectedAsyncControllerDescriptor controllerDescriptor) { // this only happens once per controller type, for the lifetime of the application, // so we do not need to cache the results return controllerDescriptor.GetCustomAttributes(typeof(RoutePrefixAttribute), inherit: false) .Cast<RoutePrefixAttribute>().SingleOrDefault(); }