VMF.NET.Json 0.1.3

dotnet add package VMF.NET.Json --version 0.1.3
                    
NuGet\Install-Package VMF.NET.Json -Version 0.1.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VMF.NET.Json" Version="0.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VMF.NET.Json" Version="0.1.3" />
                    
Directory.Packages.props
<PackageReference Include="VMF.NET.Json" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VMF.NET.Json --version 0.1.3
                    
#r "nuget: VMF.NET.Json, 0.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VMF.NET.Json@0.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VMF.NET.Json&version=0.1.3
                    
Install as a Cake Addin
#tool nuget:?package=VMF.NET.Json&version=0.1.3
                    
Install as a Cake Tool

VMF.NET

Build & Test NuGet Docs

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() and GetHashCode()
  • 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.3 100 4/9/2026
0.1.2 92 4/8/2026
0.1.1 85 4/8/2026
0.1.0 96 4/8/2026