Skip to content

Commit

Permalink
[r] namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
i4004 committed May 3, 2024
1 parent d54ec4d commit 5b1f60d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Simplify.Web.Controllers.Execution;

public class ControllerExecutorResolver(IEnumerable<IControllerExecutor> executors) : IControllerExecutorResolver
public class ControllerExecutorResolver(IReadOnlyList<IControllerExecutor> executors) : IControllerExecutorResolver
{
public IControllerExecutor Resolve(IControllerMetadata controller) =>
executors.FirstOrDefault(x => x.CanHandle(controller))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace Simplify.Web.Controllers.RouteMatching.Matcher;
namespace Simplify.Web.Controllers.RouteMatching;

/// <summary>
/// Represent an HTTP route matching result.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
namespace Simplify.Web.Controllers.RouteMatching.Matcher;
using Simplify.Web.Meta.Controllers;

namespace Simplify.Web.Controllers.RouteMatching;

/// <summary>
/// Represent a HTTP route parser and matcher.
/// </summary>
public interface IRouteMatcher
{
bool CanHandle(IControllerMetadata controller);

/// <summary>
/// Matches the specified route.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Simplify.Web.Controllers.RouteMatching.Matcher;
using Simplify.Web.Meta.Controllers;

namespace Simplify.Web.Controllers.RouteMatching;
Expand Down
13 changes: 13 additions & 0 deletions src/Simplify.Web/Controllers/RouteMatching/RouteMatcherResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Simplify.Web.Meta.Controllers;

namespace Simplify.Web.Controllers.RouteMatching;

public class RouteMatcherResolver(IReadOnlyList<IRouteMatcher> matchers) : IRouteMatcherResolver
{
public IRouteMatcher Resolve(IControllerMetadata controller) =>
matchers.FirstOrDefault(x => x.CanHandle(controller))
?? throw new InvalidOperationException("No matching route matcher found for controller type: " + controller.ControllerType);
}

0 comments on commit 5b1f60d

Please sign in to comment.