#### [Abblix\.Oidc\.Server\.Mvc](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc 'index')
### [Abblix\.Oidc\.Server\.Mvc\.Features\.ConfigurableRoutes](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes 'Abblix\.Oidc\.Server\.Mvc\.Features\.ConfigurableRoutes')

## ConfigurableRouteConvention Class

A convention that resolves tokenized route templates using configuration values,
supporting fallback values with the syntax: \[route:TokenName?FallbackValue\]\.

```csharp
public class ConfigurableRouteConvention : Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelConvention
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → ConfigurableRouteConvention

Implements [Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.IApplicationModelConvention](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.iapplicationmodelconvention 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.IApplicationModelConvention')
### Constructors

## ConfigurableRouteConvention\(string, IConfigurationSection\) Constructor {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.ConfigurableRouteConvention(string,Microsoft.Extensions.Configuration.IConfigurationSection)}

Initializes a new instance of the [ConfigurableRouteConvention](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention 'Abblix\.Oidc\.Server\.Mvc\.Features\.ConfigurableRoutes\.ConfigurableRouteConvention') class\.

```csharp
public ConfigurableRouteConvention(string prefix="route", Microsoft.Extensions.Configuration.IConfigurationSection? configSection=null);
```
#### Parameters

###### `prefix` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.ConfigurableRouteConvention(string,Microsoft.Extensions.Configuration.IConfigurationSection).prefix}

The token prefix to recognize in route templates\. Defaults to "route"\.

###### `configSection` [Microsoft\.Extensions\.Configuration\.IConfigurationSection](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.iconfigurationsection 'Microsoft\.Extensions\.Configuration\.IConfigurationSection') {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.ConfigurableRouteConvention(string,Microsoft.Extensions.Configuration.IConfigurationSection).configSection}

The configuration section to use for token resolution\.

### Remarks
Tokens must follow the format: \[route:MyToken\] or \[route:MyToken?FallbackValue\]\.
### Methods

## ConfigurableRouteConvention\.Apply\(ApplicationModel\) Method {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModel)}

Applies the route token resolution to all controllers and actions in the application model\.

```csharp
public void Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModel application);
```
#### Parameters

###### `application` [Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.ApplicationModel](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.applicationmodel 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.ApplicationModel') {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModel).application}

The application model to apply the convention to\.

Implements [Apply\(ApplicationModel\)](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.iapplicationmodelconvention.apply#microsoft-aspnetcore-mvc-applicationmodels-iapplicationmodelconvention-apply(microsoft-aspnetcore-mvc-applicationmodels-applicationmodel) 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.IApplicationModelConvention\.Apply\(Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.ApplicationModel\)')

#### Exceptions

[System\.InvalidOperationException](https://learn.microsoft.com/en-us/dotnet/api/system.invalidoperationexception 'System\.InvalidOperationException')  
Thrown if a route token is not found in the configuration\.

## ConfigurableRouteConvention\.Apply\(SelectorModel\) Method {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.SelectorModel)}

Applies token replacement to a single selector's route template\.

```csharp
public void Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.SelectorModel selector);
```
#### Parameters

###### `selector` [Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.SelectorModel](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.selectormodel 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.SelectorModel') {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.SelectorModel).selector}

The [Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.SelectorModel](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.selectormodel 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.SelectorModel') whose route template may contain tokens\.

## ConfigurableRouteConvention\.Resolve\(string\) Method {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.Resolve(string)}

Replaces all recognized route tokens in the format \[route:TokenName?Fallback\] with their resolved values\.

```csharp
public string Resolve(string template);
```
#### Parameters

###### `template` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.Features.ConfigurableRoutes.ConfigurableRouteConvention.Resolve(string).template}

The original template string\.

#### Returns
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')  
The resolved route template string\.

#### Exceptions

[System\.InvalidOperationException](https://learn.microsoft.com/en-us/dotnet/api/system.invalidoperationexception 'System\.InvalidOperationException')  
Thrown if a token cannot be resolved and no fallback is provided\.
