< Summary

Information
Class: NanoRoute.RouterConfig
Assembly: NanoRoute.dll
File(s): /home/runner/work/nanoroute/nanoroute/Src/NanoRoute/Public/RouterConfig.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 75
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

/home/runner/work/nanoroute/nanoroute/Src/NanoRoute/Public/RouterConfig.cs

#LineLine coverage
 1/********************************************************************************
 2* RouterConfig.cs                                                               *
 3*                                                                               *
 4* Author: Denes Solti                                                           *
 5********************************************************************************/
 6using System;
 7
 8namespace NanoRoute
 9{
 10    /// <summary>
 11    /// Defines how the router prioritizes literal and parameterized child segments during matching.
 12    /// </summary>
 13    /// <example>
 14    /// <code>
 15    /// builder.ConfigureRouting(config =&gt; config with { MatchingPrecedence = MatchingPrecedence.ParameterizedFirst }
 16    /// </code>
 17    /// </example>
 18    public enum MatchingPrecedence
 19    {
 20        /// <summary>
 21        /// Instructs the router to select literal child segments before parameterized child segments.
 22        /// </summary>
 23        /// <example>
 24        /// <code>
 25        /// builder.ConfigureRouting(config =&gt; config with { MatchingPrecedence = MatchingPrecedence.LiteralFirst });
 26        /// </code>
 27        /// </example>
 28        LiteralFirst,
 29
 30        /// <summary>
 31        /// Instructs the router to select parameterized child segments before literal child segments.
 32        /// </summary>
 33        /// <example>
 34        /// <code>
 35        /// builder.ConfigureRouting(config =&gt; config with { MatchingPrecedence = MatchingPrecedence.ParameterizedFir
 36        /// </code>
 37        /// </example>
 38        ParameterizedFirst
 39    }
 40
 41    /// <summary>
 42    /// Configures runtime behavior of <see cref="Router"/> instances.
 43    /// </summary>
 44    /// <example>
 45    /// <code>
 46    /// builder.ConfigureRouting(config =&gt; config with
 47    /// {
 48    ///     MatchingPrecedence = MatchingPrecedence.ParameterizedFirst
 49    /// });
 50    /// </code>
 51    /// </example>
 52    public record RouterConfig
 53    {
 54        /// <summary>
 55        /// Gets or sets how NanoRoute prioritizes literal and parameterized child segments at the same depth.
 56        /// </summary>
 57        /// <exception cref="ArgumentOutOfRangeException">Thrown when the assigned value is not a defined <see cref="Mat
 58        /// <example>
 59        /// <code>
 60        /// builder.ConfigureRouting(config =&gt; config with { MatchingPrecedence = MatchingPrecedence.ParameterizedFir
 61        /// </code>
 62        /// </example>
 63        public MatchingPrecedence MatchingPrecedence
 64        {
 65            get;
 66            init
 167            {
 168                if (!Enum.IsDefined(typeof(MatchingPrecedence), value))
 169                    throw new ArgumentOutOfRangeException(nameof(value));
 70
 171                field = value;
 172            }
 73        }
 74    }
 75}