1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
15 using System.Reflection;
\r
17 public abstract class ControllerDescriptor : ICustomAttributeProvider {
\r
19 public virtual string ControllerName {
\r
21 string typeName = ControllerType.Name;
\r
22 if (typeName.EndsWith("Controller", StringComparison.OrdinalIgnoreCase)) {
\r
23 return typeName.Substring(0, typeName.Length - "Controller".Length);
\r
30 public abstract Type ControllerType {
\r
34 public abstract ActionDescriptor FindAction(ControllerContext controllerContext, string actionName);
\r
36 public abstract ActionDescriptor[] GetCanonicalActions();
\r
38 public virtual object[] GetCustomAttributes(bool inherit) {
\r
39 return GetCustomAttributes(typeof(object), inherit);
\r
42 public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) {
\r
43 if (attributeType == null) {
\r
44 throw new ArgumentNullException("attributeType");
\r
47 return (object[])Array.CreateInstance(attributeType, 0);
\r
50 public virtual bool IsDefined(Type attributeType, bool inherit) {
\r
51 if (attributeType == null) {
\r
52 throw new ArgumentNullException("attributeType");
\r