using EmbedIO.Routing; using EmbedIO.Utilities; using System; namespace EmbedIO { partial class WebModuleContainerExtensions { /// /// Creates an instance of and adds it to a module container. /// /// The type of the module container. /// The on which this method is called. /// The base route of the module. /// A callback used to configure the newly-created . /// with a added. /// is . /// is . /// /// /// /// public static TContainer WithRouting(this TContainer @this, string baseRoute, Action configure) where TContainer : class, IWebModuleContainer => WithRouting(@this, null, baseRoute, configure); /// /// Creates an instance of and adds it to a module container, /// giving it the specified if not . /// /// The type of the module container. /// The on which this method is called. /// The name. /// The base route of the module. /// A callback used to configure the newly-created . /// with a added. /// is . /// is . /// /// /// /// public static TContainer WithRouting(this TContainer @this, string? name, string baseRoute, Action configure) where TContainer : class, IWebModuleContainer { configure = Validate.NotNull(nameof(configure), configure); var module = new RoutingModule(baseRoute); return WithModule(@this, name, module, configure); } } }