Skip to content

Commit b52d364

Browse files
committed
[add] missing XML comments
[r] optimization
1 parent ac7398f commit b52d364

103 files changed

Lines changed: 896 additions & 65 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Simplify.Web/Controllers/ControllerMetaDataExtensions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
namespace Simplify.Web.Controllers;
44

5+
/// <summary>
6+
/// Provides the controller metadata extensions.
7+
/// </summary>
58
public static class ControllerMetaDataExtensions
69
{
10+
/// <summary>
11+
/// Converts to controller metadata to matched controller.
12+
/// </summary>
13+
/// <param name="metaData">The meta data.</param>
714
public static IMatchedController ToMatchedController(this IControllerMetadata metaData) =>
815
new MatchedController(metaData);
916
}

src/Simplify.Web/Controllers/Execution/IControllerExecutor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ namespace Simplify.Web.Controllers.Execution;
99
public interface IControllerExecutor
1010
{
1111
/// <summary>
12-
/// Determines whether this executor can execute controller.
12+
/// Determines whether this executor can execute the controller.
1313
/// </summary>
1414
/// <param name="controllerMetadata">The controller metadata.</param>
1515
bool CanHandle(IControllerMetadata controllerMetadata);
1616

1717
/// <summary>
18-
/// Creates the actual controller and executes it.
18+
/// Creates an actual controller and executes it.
1919
/// </summary>
2020
/// <param name="matchedController">The matched controller.</param>
2121
Task<ControllerResponse?> ExecuteAsync(IMatchedController matchedController);

src/Simplify.Web/Controllers/IMatchedController.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,24 @@
33

44
namespace Simplify.Web.Controllers;
55

6+
/// <summary>
7+
/// Represents a matcher controller.
8+
/// </summary>
69
public interface IMatchedController
710
{
11+
/// <summary>
12+
/// Gets the controller.
13+
/// </summary>
14+
/// <value>
15+
/// The controller.
16+
/// </value>
817
public IControllerMetadata Controller { get; }
918

19+
/// <summary>
20+
/// Gets the route parameters.
21+
/// </summary>
22+
/// <value>
23+
/// The route parameters.
24+
/// </value>
1025
public IReadOnlyDictionary<string, object>? RouteParameters { get; }
1126
}

src/Simplify.Web/Controllers/MatchedController.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,25 @@
33

44
namespace Simplify.Web.Controllers;
55

6+
/// <summary>
7+
/// Provides the matcher controller.
8+
/// </summary>
9+
/// <seealso cref="IMatchedController" />
610
public class MatchedController(IControllerMetadata metaData, IReadOnlyDictionary<string, object>? routeParameters = null) : IMatchedController
711
{
12+
/// <summary>
13+
/// Gets the controller.
14+
/// </summary>
15+
/// <value>
16+
/// The controller.
17+
/// </value>
818
public IControllerMetadata Controller { get; } = metaData;
919

20+
/// <summary>
21+
/// Gets the route parameters.
22+
/// </summary>
23+
/// <value>
24+
/// The route parameters.
25+
/// </value>
1026
public IReadOnlyDictionary<string, object>? RouteParameters { get; } = routeParameters;
1127
}

src/Simplify.Web/Controllers/MatchedControllersExtensions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33

44
namespace Simplify.Web.Controllers;
55

6+
/// <summary>
7+
/// Provides the matcher controllers extensions.
8+
/// </summary>
69
public static class MatchedControllersExtensions
710
{
11+
/// <summary>
12+
/// Sorts the matched controllers by run priority.
13+
/// </summary>
14+
/// <param name="items">The items.</param>
815
public static IOrderedEnumerable<IMatchedController> SortByRunPriority(this IEnumerable<IMatchedController> items) =>
916
items.OrderBy(x => x.Controller.ExecParameters?.RunPriority ?? 0);
1017
}

src/Simplify.Web/Controllers/Meta/ControllerExecParameters.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public class ControllerExecParameters(IDictionary<HttpMethod, IControllerRoute>?
1717
/// <summary>
1818
/// Gets the controller handling routes.
1919
/// </summary>
20+
/// <value>
21+
/// The routes.
22+
/// </value>
2023
public IDictionary<HttpMethod, IControllerRoute> Routes { get; } = routes ?? new Dictionary<HttpMethod, IControllerRoute>();
2124

2225
/// <summary>

src/Simplify.Web/Controllers/Meta/ControllerMetadata.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Simplify.Web.Controllers.Meta;
1010
/// <summary>
1111
/// Provides the controller base metadata information.
1212
/// </summary>
13+
/// <seealso cref="IControllerMetadata" />
1314
/// <remarks>
1415
/// Initializes a new instance of the <see cref="ControllerMetadata" /> class.
1516
/// </remarks>
@@ -19,25 +20,45 @@ public abstract class ControllerMetadata(Type controllerType) : IControllerMetad
1920
/// <summary>
2021
/// Gets the type of the controller.
2122
/// </summary>
23+
/// <value>
24+
/// The type of the controller.
25+
/// </value>
2226
public Type ControllerType { get; } = controllerType;
2327

2428
/// <summary>
2529
/// Gets the controller execute parameters.
2630
/// </summary>
31+
/// <value>
32+
/// The execute parameters.
33+
/// </value>
2734
public ControllerExecParameters? ExecParameters { get; protected set; }
2835

2936
/// <summary>
3037
/// Gets the controller role information.
3138
/// </summary>
39+
/// <value>
40+
/// The role.
41+
/// </value>
3242
public ControllerRole? Role { get; } = BuildControllerRole(controllerType);
3343

3444
/// <summary>
3545
/// Gets the controller security information.
3646
/// </summary>
47+
/// <value>
48+
/// The security.
49+
/// </value>
3750
public ControllerSecurity? Security { get; } = BuildControllerSecurity(controllerType);
3851

52+
/// <summary>
53+
/// Builds the controller route.
54+
/// </summary>
55+
/// <param name="path">The path.</param>
3956
protected abstract IControllerRoute BuildControllerRoute(string path);
4057

58+
/// <summary>
59+
/// Builds the controller execute parameters.
60+
/// </summary>
61+
/// <param name="controllerType">Type of the controller.</param>
4162
protected ControllerExecParameters? BuildControllerExecParameters(ICustomAttributeProvider controllerType)
4263
{
4364
var priority = 0;

src/Simplify.Web/Controllers/Meta/ControllerMetadataExtensions.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,39 @@
44

55
namespace Simplify.Web.Controllers.Meta;
66

7+
/// <summary>
8+
/// Provides the controller metadata route extensions.
9+
/// </summary>
710
public 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);

src/Simplify.Web/Controllers/Meta/Factory/ControllerMetadataFactoryResolver.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44

55
namespace Simplify.Web.Controllers.Meta.Factory;
66

7+
/// <summary>
8+
/// Provides the controller metadata factories resolver
9+
/// </summary>
10+
/// <seealso cref="IControllerMetadataFactoryResolver" />
711
public class ControllerMetadataFactoryResolver(IEnumerable<IControllerMetadataFactory> factories) : IControllerMetadataFactoryResolver
812
{
13+
/// <summary>
14+
/// Resolves the controller metadata factory for specified type.
15+
/// </summary>
16+
/// <param name="controllerType">Type of the controller.</param>
17+
/// <returns></returns>
18+
/// <exception cref="InvalidOperationException">No matching controller metadata factory found for controller type: " + controllerType</exception>
919
public IControllerMetadataFactory Resolve(Type controllerType) =>
1020
factories.FirstOrDefault(x => x.CanHandle(controllerType))
1121
?? throw new InvalidOperationException("No matching controller metadata factory found for controller type: " + controllerType);

src/Simplify.Web/Controllers/Meta/Factory/IControllerMetadataFactoryResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Simplify.Web.Controllers.Meta.Factory;
44

55
/// <summary>
6-
/// Represents controller metadata factories resolver
6+
/// Represents a controller metadata factories resolver
77
/// </summary>
88
public interface IControllerMetadataFactoryResolver
99
{

0 commit comments

Comments
 (0)