NanoProxy 0.3.6

dotnet add package NanoProxy --version 0.3.6
                    
NuGet\Install-Package NanoProxy -Version 0.3.6
                    
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="NanoProxy" Version="0.3.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NanoProxy" Version="0.3.6" />
                    
Directory.Packages.props
<PackageReference Include="NanoProxy" />
                    
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 NanoProxy --version 0.3.6
                    
#r "nuget: NanoProxy, 0.3.6"
                    
#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 NanoProxy@0.3.6
                    
#: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=NanoProxy&version=0.3.6
                    
Install as a Cake Addin
#tool nuget:?package=NanoProxy&version=0.3.6
                    
Install as a Cake Tool

NanoProxy

Nuget License

NanoProxy is a lightweight, high-performance .NET library for generating runtime proxies that intercept property setters. It enables scenarios such as change tracking, validation, logging, and auditing without modifying your original class code.

Features

  • Dynamic Proxy Generation - Uses System.Reflection.Emit for efficient runtime proxy creation
  • Property Setter Interception - Captures both old and new values on property changes
  • Type Support - Works with value types, nullable types, and reference types (strings, objects)
  • Thread-Safe - Built-in thread-safe proxy type caching for optimal performance
  • Zero Dependencies - Lightweight library with no external dependencies
  • Virtual Property Override - Leverages inheritance to intercept virtual property setters
  • .NET 8 Compatible - Built for modern .NET applications

Installation

Install NanoProxy via NuGet Package Manager:

dotnet add package NanoProxy

Usage Example

Suppose you have a class (currently parameterless constructor is required):

public class TestClass 
{ 
    public virtual int IntegerProperty { get; set; } 
    public virtual int? NullableIntegerProperty { get; set; } 
    public virtual string StringProperty { get; set; } 
}

You can create a proxy and intercept virtual property changes:

var builder = new NanoProxy.NanoProxyBuilder();
var proxy = builder.CreateProxy<TestClass>();
proxy.Interceptor = (value, oldValue, propertyInfo) => 
{
    Console.WriteLine($"Property '{propertyInfo}' changed from '{oldValue}' to '{value}'"); 
};
proxy.WrapedObject.NullableIntegerProperty = 42; // Property 'NullableIntegerProperty' changed from '' to '42' 
proxy.WrapedObject.NullableIntegerProperty = 2; /// Property 'NullableIntegerProperty' changed from '42' to '2' 

Where interceptor is defined as:

public delegate void SetInterceptor(object value, object oldValue, PropertyInfo propertyInfo);

Testing

NanoProxy includes NUnit-based tests. To run them:

  1. Open the solution in Visual Studio 2022.
  2. Build the solution.
  3. Use Test Explorer to run all tests.

Requirements

  • .NET 8.0 or later
  • Visual Studio 2022 or compatible IDE

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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 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. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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.3.6 108 1/11/2026
0.3.5 111 1/11/2026
0.3.4 118 1/11/2026
0.3.3 115 1/10/2026
0.3.2 113 1/10/2026
0.2.2 113 1/7/2026
0.2.1 112 1/7/2026
0.2.0 114 1/7/2026
0.1.0 111 1/7/2026