/
ControllerInfo.cs
62 lines (55 loc) · 2 KB
/
ControllerInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.ComponentModel;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
namespace Loby.AspNetCore.Services.Models
{
/// <summary>
/// Provide some information about a <see cref="Controller"/>.
/// </summary>
public class ControllerInfo
{
/// <summary>
/// An string representing the actual name of controller.
/// </summary>
public string Name { get; set; }
/// <summary>
/// An string representing a display name for controller.
/// </summary>
/// <remarks>
/// Display name could be provided by using <see cref="DisplayNameAttribute"/>.
/// </remarks>
public string DisplayName { get; set; }
/// <summary>
/// The name of area containing current controller.
/// </summary>
/// <remarks>
/// Area name could be provided by using <see cref="AreaAttribute"/>.
/// </remarks>
public string AreaName { get; set; }
/// <summary>
/// A flag that specifies the current controller is protected or not.
/// </summary>
/// <remarks>
/// Protection could be done by using <see cref="AuthorizeAttribute"/>.
/// </remarks>
public bool IsSecured { get; set; }
/// <summary>
/// An string representing an id that generated by combination of
/// area name and controller name.
/// </summary>
/// <remarks>
/// Pattern: AreaName:ControllerName
/// </remarks>
public string Id => $"{AreaName}:{Name}".ToLower();
/// <summary>
/// A list that contains all the custom attributes applied to the current controller.
/// </summary>
public IList<Attribute> Attributes { get; set; }
/// <summary>
/// A list of all actions defined in the current controller.
/// </summary>
public IList<ControllerActionInfo> Actions { get; set; }
}
}