Class RouterExtensions
- Namespace
- IceRpc
- Assembly
- IceRpc.dll
Provides extension methods for Router to add a sub-router or to add a middleware that sets a feature.
public static class RouterExtensions
- Inheritance
-
RouterExtensions
- Inherited Members
Methods
Route(Router, string, Action<Router>)
Creates a sub-router, configures this sub-router and mounts it (with
Mount(string, IDispatcher)) at the given prefix
.
public static Router Route(this Router router, string prefix, Action<Router> configure)
Parameters
router
RouterThe router being configured.
prefix
stringThe prefix of the route to the sub-router.
configure
Action<Router>A delegate that configures the new sub-router.
Returns
- Router
The new sub-router.
Exceptions
- FormatException
Thrown if
prefix
is not a valid path.
UseDispatchInformation(Router)
Adds a middleware that creates and inserts the IDispatchInformationFeature feature in all requests.
public static Router UseDispatchInformation(this Router router)
Parameters
router
RouterThe router being configured.
Returns
- Router
The router being configured.
UseFeature<TFeature>(Router, TFeature)
Adds a middleware that sets a feature in all requests.
public static Router UseFeature<TFeature>(this Router router, TFeature feature)
Parameters
router
RouterThe router being configured.
feature
TFeatureThe value of the feature to set in all requests.
Returns
- Router
The router being configured.
Type Parameters
TFeature
The type of the feature.