Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I decided to dig a bit deeper and found exactly what I was looking for after searching through the MVC source code. The convention for controller names is deep inside the roots of the MVC Framework, especifically in two classes <code>ControllerDescriptor</code> and <code>ControllerTypeCache</code>.</p> <p>In <code>ControllerDescriptor</code> it is given by the following attribute:</p> <pre><code>public virtual string ControllerName { get { string typeName = ControllerType.Name; if (typeName.EndsWith("Controller", StringComparison.OrdinalIgnoreCase)) { return typeName.Substring(0, typeName.Length - "Controller".Length); } return typeName; } } </code></pre> <p>In <code>ControllerTypeCache</code> it is given by the following methods:</p> <pre><code>internal static bool IsControllerType(Type t) { return t != null &amp;&amp; t.IsPublic &amp;&amp; t.Name.EndsWith("Controller", StringComparison.OrdinalIgnoreCase) &amp;&amp; !t.IsAbstract &amp;&amp; typeof(IController).IsAssignableFrom(t); } public void EnsureInitialized(IBuildManager buildManager) { if (_cache == null) { lock (_lockObj) { if (_cache == null) { List&lt;Type&gt; controllerTypes = TypeCacheUtil.GetFilteredTypesFromAssemblies(_typeCacheName, IsControllerType, buildManager); var groupedByName = controllerTypes.GroupBy( t =&gt; t.Name.Substring(0, t.Name.Length - "Controller".Length), StringComparer.OrdinalIgnoreCase); _cache = groupedByName.ToDictionary( g =&gt; g.Key, g =&gt; g.ToLookup(t =&gt; t.Namespace ?? String.Empty, StringComparer.OrdinalIgnoreCase), StringComparer.OrdinalIgnoreCase); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload