VMF.NET.Runtime
0.1.3
dotnet add package VMF.NET.Runtime --version 0.1.3
NuGet\Install-Package VMF.NET.Runtime -Version 0.1.3
<PackageReference Include="VMF.NET.Runtime" Version="0.1.3" />
<PackageVersion Include="VMF.NET.Runtime" Version="0.1.3" />
<PackageReference Include="VMF.NET.Runtime" />
paket add VMF.NET.Runtime --version 0.1.3
#r "nuget: VMF.NET.Runtime, 0.1.3"
#:package VMF.NET.Runtime@0.1.3
#addin nuget:?package=VMF.NET.Runtime&version=0.1.3
#tool nuget:?package=VMF.NET.Runtime&version=0.1.3
VMF.NET
VMF.NET is a lightweight modeling framework for .NET. It translates annotated C# interfaces into powerful implementations via a Roslyn Source Generator — no separate build step, no code-gen tooling, no boilerplate. It works with .NET 6 and later. VMF.NET is a port of the java VMF framework.
It generates/supports:
- Getters and setters
- Default values
- Containment
- Builder API
Equals()andGetHashCode()- Deep and shallow cloning
- Change notification (
INotifyPropertyChanged/INotifyCollectionChanged) - Undo/redo
- Object graph traversal via iterators
- Immutable types and read-only wrappers
- Delegation
- Annotations
- Reflection
- JSON serialization (
System.Text.Json) - JSON Schema generation
A VMF.NET model consists of annotated C# interfaces. Just define the interface and its properties — VMF.NET generates a fully functional implementation including property setters/getters, builders, change listeners, and much more:
Using VMF.NET
Checkout the tutorial projects.
Add the NuGet packages to your project:
<PackageReference Include="VMF.NET.Runtime" Version="*" />
<PackageReference Include="VMF.NET.SourceGenerator" Version="*" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
Replace
*with a specific version (e.g.,0.1.1) for reproducible builds. See NuGet for the latest version.
Define your model as annotated partial interfaces. The interfaces must be marked with [VmfModel] and the namespace must end with .VmfModel:
using VMF.NET.Runtime.Core;
namespace MyApp.VmfModel;
[VmfModel]
public partial interface IParent
{
[Contains(Opposite = nameof(IChild.Parent))]
IList<IChild> Children { get; }
string Name { get; set; }
}
[VmfModel]
public partial interface IChild
{
[Container(Opposite = nameof(IParent.Children))]
IParent? Parent { get; }
int Value { get; set; }
}
The source generator runs automatically on every build — no task to invoke. The generated implementation is immediately available:
// Create via factory method
var parent = IParent.NewInstance();
parent.Name = "Root";
// Or use the builder
var child = IChild.Build()
.WithValue(42)
.Build();
parent.Children.Add(child);
// Containment is tracked automatically
Console.WriteLine(child.Parent == parent); // True
// Change listeners
parent.Vmf().Changes().AddListener(change => {
Console.WriteLine($"Changed: {change.PropertyName}");
});
// Deep clone
var copy = parent.Clone();
// Read-only wrapper
IReadOnlyParent ro = parent.AsReadOnly();
JSON Serialization
Add the JSON package for System.Text.Json support:
<PackageReference Include="VMF.NET.Json" Version="*" />
var options = new JsonSerializerOptions
{
Converters = { new VmfJsonConverterFactory() },
WriteIndented = true
};
string json = JsonSerializer.Serialize(parent, options);
IParent restored = JsonSerializer.Deserialize<IParent>(json, options)!;
Building VMF.NET
Requirements
- .NET 6 SDK or later
- Internet connection (NuGet packages are restored automatically)
Command Line
dotnet build
dotnet test
Packing
dotnet pack --configuration Release
Testing VMF.NET
dotnet test --configuration Release --verbosity normal
The test suite includes 163 tests across unit and integration projects.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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 was computed. 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 was computed. 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 was computed. 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. |
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on VMF.NET.Runtime:
| Package | Downloads |
|---|---|
|
VMF.NET.Json
VMF.NET — Visual Modeling Framework for .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.