NuExt.Minimal.Mvvm
0.7.0
Prefix Reserved
See the version list below for details.
dotnet add package NuExt.Minimal.Mvvm --version 0.7.0
NuGet\Install-Package NuExt.Minimal.Mvvm -Version 0.7.0
<PackageReference Include="NuExt.Minimal.Mvvm" Version="0.7.0" />
<PackageVersion Include="NuExt.Minimal.Mvvm" Version="0.7.0" />
<PackageReference Include="NuExt.Minimal.Mvvm" />
paket add NuExt.Minimal.Mvvm --version 0.7.0
#r "nuget: NuExt.Minimal.Mvvm, 0.7.0"
#:package NuExt.Minimal.Mvvm@0.7.0
#addin nuget:?package=NuExt.Minimal.Mvvm&version=0.7.0
#tool nuget:?package=NuExt.Minimal.Mvvm&version=0.7.0
NuExt.Minimal.Mvvm
NuExt.Minimal.Mvvm is a high-performance, dependency-free MVVM framework for .NET focused on robust async flows, deterministic command execution, and a clear, minimal API.
Features
Core:
Minimal.Mvvm.BindableBase— lightweightINotifyPropertyChangedbase.Minimal.Mvvm.ViewModelBase— lean ViewModel foundation with simple service access.
Command Model (self-validating): All commands (
RelayCommand,RelayCommand<T>,AsyncCommand,AsyncCommand<T>,CompositeCommand) validate their state internally: ifCanExecute(parameter)isfalse,Execute(parameter)performs no action. This guarantees consistent behavior for both UI-bound and programmatic calls.Command Implementations:
Minimal.Mvvm.RelayCommand/RelayCommand<T>- classic, synchronous delegate-based commands with optional concurrency control.Minimal.Mvvm.AsyncCommand/AsyncCommand<T>- full-featured asynchronous commands with cancellation support, reentrancy control, and predictable error propagation.Minimal.Mvvm.CompositeCommand- aggregates multiple commands and executes them sequentially; awaitsExecuteAsync(...)and callsExecute(...)for non-async commands.
Async & Concurrency:
- Explicit separation:
ICommand.Execute(fire-and-forget) vsIAsyncCommand.ExecuteAsync(awaitable withCancellationToken). - Built-in reentrancy control via
AllowConcurrentExecution. - Comprehensive Exception Handling: Local (
UnhandledException) and global (AsyncCommand.GlobalUnhandledException) events withHandledpropagation control.
- Explicit separation:
Service Provider Integration:
Minimal.Mvvm.ServiceProvider: Lightweight service provider for registration and resolution of services, facilitating dependency injection within your application.
Recommended Companion Package
For an enhanced development experience, we highly recommend using the NuExt.Minimal.Mvvm.SourceGenerator package alongside this framework. It provides compile-time boilerplate generation for ViewModels.
Installation
Via NuGet:
dotnet add package NuExt.Minimal.Mvvm
Or via Visual Studio:
- Go to
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.... - Search for
NuExt.Minimal.Mvvm. - Click "Install".
Source Code Package
In addition to the standard package, there is also a source code package available: NuExt.Minimal.Mvvm.Sources. This package allows you to embed the entire framework directly into your application, enabling easier source code exploring and debugging.
To install the source code package, use the following command:
dotnet add package NuExt.Minimal.Mvvm.Sources
Or via Visual Studio:
- Go to
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.... - Search for
NuExt.Minimal.Mvvm.Sources. - Click "Install".
Usage
Example: Advanced AsyncCommand with Concurrency and Cancellation
public class SearchViewModel : ViewModelBase
{
public IAsyncCommand<string> SearchCommand { get; }
public ICommand CancelCommand { get; }
public SearchViewModel()
{
SearchCommand = new AsyncCommand<string>(SearchAsync, CanSearch)
{
AllowConcurrentExecution = true
};
AsyncCommand.GlobalUnhandledException += (sender, e) =>
{
Logger.LogError(e.Exception, "Global command error");
e.Handled = true;
};
CancelCommand = new RelayCommand(() => SearchCommand.Cancel());
}
private async Task SearchAsync(string query, CancellationToken cancellationToken)
{
await Task.Delay(1000, cancellationToken);
Results = $"Results for: {query}";
}
private bool CanSearch(string query) => !string.IsNullOrWhiteSpace(query);
private string _results;
public string Results
{
get => _results;
private set => SetProperty(ref _results, value);
}
}
Example: Two-Tier Exception Handling
public class DataViewModel : ViewModelBase
{
public IAsyncCommand LoadDataCommand { get; }
public DataViewModel()
{
LoadDataCommand = new AsyncCommand(LoadDataAsync);
LoadDataCommand.UnhandledException += (sender, e) =>
{
if (e.Exception is HttpRequestException httpEx)
{
ShowError($"Network error: {httpEx.Message}");
e.Handled = true;
}
};
}
private async Task LoadDataAsync(CancellationToken cancellationToken)
{
throw new HttpRequestException("Connection failed");
}
}
Example Using Source Generator
To further simplify your ViewModel development, consider using the source generator provided by the NuExt.Minimal.Mvvm.SourceGenerator package. Here's an example:
using Minimal.Mvvm;
public partial class ProductViewModel : ViewModelBase
{
[Notify]
private string _name = string.Empty;
[Notify(Setter = AccessModifier.Private)]
private decimal _price;
public ProductViewModel()
{
SaveCommand = new AsyncCommand(SaveAsync);
}
[Notify]
private async Task SaveAsync(CancellationToken token)
{
await Task.Delay(500, token);
Price = 99.99m;
}
}
This automation helps to maintain clean and efficient code, improving overall productivity. For details on installing and using the source generator, refer to the NuExt.Minimal.Mvvm.SourceGenerator documentation.
Example Using ServiceProvider
public class MyService
{
public string GetData() => "Hello from MyService!";
}
public class MyViewModel : ViewModelBase
{
public IRelayCommand MyCommand { get; }
public MyViewModel()
{
// Register services
ServiceProvider.Default.RegisterService<MyService>();
MyCommand = new RelayCommand(() =>
{
// Resolve and use services
var myService = ServiceProvider.Default.GetService<MyService>();
var data = myService.GetData();
// Use the data
});
}
}
Contributing
Issues and PRs are welcome. Keep changes minimal and performance-conscious.
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on NuExt.Minimal.Mvvm:
| Package | Downloads |
|---|---|
|
NuExt.Minimal.Mvvm.Legacy
Legacy-only add-on for NuExt.Minimal.Mvvm (net462/netstandard2.0). Provides backports (e.g., AsyncValueCommand). Not deprecated; NOT for modern .NET. |
|
|
NuExt.Minimal.Mvvm.Wpf
NuExt.Minimal.Mvvm.Wpf is an extension for the lightweight MVVM framework NuExt.Minimal.Mvvm, specifically designed for WPF applications. Commonly Used Types: Minimal.Mvvm.ModelBase Minimal.Mvvm.Wpf.ControlViewModel Minimal.Mvvm.Wpf.DocumentContentViewModelBase Minimal.Mvvm.Wpf.WindowViewModel Minimal.Mvvm.Wpf.IAsyncDialogService Minimal.Mvvm.Wpf.IAsyncDocument Minimal.Mvvm.Wpf.IAsyncDocumentContent Minimal.Mvvm.Wpf.IAsyncDocumentManagerService Minimal.Mvvm.Wpf.InputDialogService Minimal.Mvvm.Wpf.OpenWindowsService Minimal.Mvvm.Wpf.SettingsService Minimal.Mvvm.Wpf.TabbedDocumentService Minimal.Mvvm.Wpf.ViewLocator Minimal.Mvvm.Wpf.WindowedDocumentService Minimal.Mvvm.Wpf.WindowPlacementService |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.3 | 136 | 3/16/2026 |
| 0.7.2 | 134 | 2/26/2026 |
| 0.7.1 | 133 | 2/23/2026 |
| 0.7.0 | 111 | 2/12/2026 |
| 0.6.0 | 120 | 1/11/2026 |
| 0.5.2 | 308 | 12/15/2025 |
| 0.5.1 | 233 | 12/14/2025 |
| 0.4.1 | 465 | 12/10/2025 |
| 0.4.0 | 182 | 12/5/2025 |
| 0.3.4 | 221 | 2/21/2025 |
| 0.3.3 | 344 | 1/26/2025 |
| 0.3.2 | 312 | 1/22/2025 |
| 0.3.1 | 318 | 1/19/2025 |
| 0.3.0 | 318 | 1/13/2025 |
| 0.2.0 | 261 | 11/14/2024 |