private void MapController(Type type) { string uri = type.Name.Replace("Controller", string.Empty); var attributes = type.GetCustomAttributes(typeof(ControllerUriAttribute), false); if (attributes.Length > 0) { uri = ((ControllerUriAttribute)attributes[0]).Uri; } ControllerMapping mapping = new ControllerMapping(type, uri); var resultType = typeof(IActionResult); foreach (var method in type.GetMethods()) { if (!resultType.IsAssignableFrom(method.ReturnType)) { continue; } mapping.Add(method); } _controllers.Add(mapping); }
private void MapController(Type type) { string uri = type.Name.Replace("Controller", string.Empty); var attributes = type.GetCustomAttributes(typeof (ControllerUriAttribute), false); if (attributes.Length > 0) uri = ((ControllerUriAttribute) attributes[0]).Uri; ControllerMapping mapping = new ControllerMapping(type, uri); var resultType = typeof (IActionResult); foreach (var method in type.GetMethods()) { if (!resultType.IsAssignableFrom(method.ReturnType)) continue; mapping.Add(method); } _controllers.Add(mapping); }