Table of Contents

Class ReflectionAutoViewModelRegistry

Namespace
Dmnk.Blazor.Mvvm
Assembly
Dmnk.Blazor.Mvvm.dll

Like ViewModelRegistry, but with an additional method AutoRegister() that automatically registers all ViewModels and their corresponding Views based on reflection.

You may prefer using the source generator - see ViewModelForAttribute.

[RequiresUnreferencedCode("Automatic registration of ViewModels and Views does not work with trimming or AOT\ncompilation. Trimming is enabled by default in Blazor WebAssembly apps when using\n'dotnet publish'. If you want to use AutoRegister, you need to either:\n\n1. Disable trimming in your project (not recommended in WASM), or\n2. Use manual registration methods (Register<TViewModel, TComponent>) instead.")]
[RequiresDynamicCode("Automatic registration of ViewModels and Views does not work with trimming or AOT\ncompilation. Trimming is enabled by default in Blazor WebAssembly apps when using\n'dotnet publish'. If you want to use AutoRegister, you need to either:\n\n1. Disable trimming in your project (not recommended in WASM), or\n2. Use manual registration methods (Register<TViewModel, TComponent>) instead.")]
public class ReflectionAutoViewModelRegistry : ViewModelRegistry, IViewModelRegistry
Inheritance
ReflectionAutoViewModelRegistry
Implements
Inherited Members

Constructors

ReflectionAutoViewModelRegistry(ILogger<ReflectionAutoViewModelRegistry>)

Like ViewModelRegistry, but with an additional method AutoRegister() that automatically registers all ViewModels and their corresponding Views based on reflection.

You may prefer using the source generator - see ViewModelForAttribute.

public ReflectionAutoViewModelRegistry(ILogger<ReflectionAutoViewModelRegistry> log)

Parameters

log ILogger<ReflectionAutoViewModelRegistry>

Methods

AutoRegister()

Automatically registers all ViewModel types that implement INotifyPropertyChanged and their corresponding View types that inherit from MvvmComponentBase<T> based on reflection.

[RequiresUnreferencedCode("Automatic registration of ViewModels and Views does not work with trimming or AOT\ncompilation. Trimming is enabled by default in Blazor WebAssembly apps when using\n'dotnet publish'. If you want to use AutoRegister, you need to either:\n\n1. Disable trimming in your project (not recommended in WASM), or\n2. Use manual registration methods (Register<TViewModel, TComponent>) instead.")]
[RequiresDynamicCode("Automatic registration of ViewModels and Views does not work with trimming or AOT\ncompilation. Trimming is enabled by default in Blazor WebAssembly apps when using\n'dotnet publish'. If you want to use AutoRegister, you need to either:\n\n1. Disable trimming in your project (not recommended in WASM), or\n2. Use manual registration methods (Register<TViewModel, TComponent>) instead.")]
public void AutoRegister()