Class LibraryConfiguration
- Namespace
- Blazing.Mvvm
- Assembly
- Blazing.Mvvm.dll
Provides configuration options for the Blazing.Mvvm library, including hosting model, parameter resolution, base path, and view model assembly registration.
public sealed class LibraryConfigurationInheritance
Properties
BasePath Deprecated
BasePath is no longer required and will be removed in a future version. The base path is now automatically detected from NavigationManager.BaseUri. This property is only retained for backward compatibility and explicit override scenarios.
Gets or sets the optional base path for the Blazor application, used for subpath hosting scenarios.
[Obsolete("BasePath is no longer required and will be removed in a future version. The base path is now automatically detected from NavigationManager.BaseUri. This property is only retained for backward compatibility and explicit override scenarios.", false)]
public string? BasePath { get; set; }Property Value
EnableMultiRouteTemplates
Gets or sets a value indicating whether multi-route template support is enabled.
public bool EnableMultiRouteTemplates { get; set; }Property Value
Examples
builder.Services.AddMvvm(options =>
{
options.EnableMultiRouteTemplates = true; // Default behavior
});
Remarks
When enabled (default), components with multiple @page directives can have all their route templates
cached and used for smart route selection during navigation. The navigation manager will automatically
select the most appropriate route template based on the parameters provided.
When disabled, the library reverts to legacy behavior where only the first (simplest) route template is cached per ViewModel. This option is provided for backward compatibility scenarios.
Default: true (enabled)
Recommendation: Keep enabled unless experiencing compatibility issues with existing code.
HostingModelType
Gets or sets the hosting model of the Blazor application.
public BlazorHostingModelType HostingModelType { get; set; }Property Value
ParameterResolutionMode
Gets or sets the parameter resolution mode for views and view models. The default is None, which disables parameter resolution via the IParameterResolver service and falls back to the default behaviour of the Blazor framework.
public ParameterResolutionMode ParameterResolutionMode { get; set; }Property Value
Methods
RegisterViewModelsFromAssemblies(IEnumerable<Assembly>)
Registers the view models from the specified collection of assemblies.
public void RegisterViewModelsFromAssemblies(IEnumerable<Assembly> assemblies)Parameters
assembliesIEnumerable<Assembly>-
The assemblies containing the view models.
RegisterViewModelsFromAssembly(params Assembly[])
Registers the view models from the specified assemblies.
public void RegisterViewModelsFromAssembly(params Assembly[] assemblies)Parameters
assembliesAssembly[]-
The assemblies containing the view models.
RegisterViewModelsFromAssemblyContaining<T>()
Registers the view models from the assembly containing the specified type T.
public void RegisterViewModelsFromAssemblyContaining<T>()Type Parameters
T-
The type whose assembly contains the view models.
RegisterViewModelsFromAssemblyContaining(Type)
Registers the view models from the assembly containing the specified type.
public void RegisterViewModelsFromAssemblyContaining(Type type)Parameters
typeType-
The type whose assembly contains the view models.