44
55namespace Simplify . Web . Controllers . Meta ;
66
7+ /// <summary>
8+ /// Provides the controller metadata route extensions.
9+ /// </summary>
710public static class ControllerMetadataRouteExtensions
811{
12+ /// <summary>
13+ /// Gets the standard controllers.
14+ /// </summary>
15+ /// <param name="list">The list.</param>
916 public static IEnumerable < IControllerMetadata > GetStandardControllers ( this IEnumerable < IControllerMetadata > list ) => list
1017 . Where ( x => ! x . IsSpecialController ( ) ) ;
1118
19+ /// <summary>
20+ /// Gets the routed controllers.
21+ /// </summary>
22+ /// <param name="list">The list.</param>
1223 public static IEnumerable < IControllerMetadata > GetRoutedControllers ( this IEnumerable < IControllerMetadata > list ) => list
1324 . GetStandardControllers ( )
1425 . Where ( x => x . ContainsRoute ( ) ) ;
1526
27+ /// <summary>
28+ /// Gets the global controllers.
29+ /// </summary>
30+ /// <param name="list">The list.</param>
1631 public static IEnumerable < IControllerMetadata > GetGlobalControllers ( this IEnumerable < IControllerMetadata > list ) => list
1732 . GetStandardControllers ( )
1833 . Where ( x => ! x . ContainsRoute ( ) ) ;
1934
35+ /// <summary>
36+ /// Gets the handler controller.
37+ /// </summary>
38+ /// <param name="list">The list.</param>
39+ /// <param name="controllerType">Type of the controller.</param>
2040 public static IControllerMetadata ? GetHandlerController ( this IEnumerable < IControllerMetadata > list , HandlerControllerType controllerType ) =>
2141 controllerType switch
2242 {
@@ -25,11 +45,19 @@ public static IEnumerable<IControllerMetadata> GetGlobalControllers(this IEnumer
2545 _ => throw new InvalidOperationException ( "Invalid controller type: " + controllerType )
2646 } ;
2747
48+ /// <summary>
49+ /// Determines whether the controller is special controller
50+ /// </summary>
51+ /// <param name="controller">The controller.</param>
2852 public static bool IsSpecialController ( this IControllerMetadata controller ) =>
2953 controller . Role
3054 is { IsForbiddenHandler : true }
3155 or { IsNotFoundHandler : true } ;
3256
57+ /// <summary>
58+ /// Determines whether the controller contains route.
59+ /// </summary>
60+ /// <param name="controller">The controller.</param>
3361 public static bool ContainsRoute ( this IControllerMetadata controller ) =>
3462 controller . ExecParameters != null &&
3563 controller . ExecParameters . Routes . Any ( route => route . Value != null ) ;
0 commit comments