MassiveDynamicProxyGenerator 1.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package MassiveDynamicProxyGenerator --version 1.2.2
NuGet\Install-Package MassiveDynamicProxyGenerator -Version 1.2.2
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="MassiveDynamicProxyGenerator" Version="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MassiveDynamicProxyGenerator --version 1.2.2
#r "nuget: MassiveDynamicProxyGenerator, 1.2.2"
#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.
// Install MassiveDynamicProxyGenerator as a Cake Addin
#addin nuget:?package=MassiveDynamicProxyGenerator&version=1.2.2

// Install MassiveDynamicProxyGenerator as a Cake Tool
#tool nuget:?package=MassiveDynamicProxyGenerator&version=1.2.2


.Net library for generate proxy class instances

Massive Dynamic Proxy Generator is a library for generating lightweight .NET proxies on the fly at runtime. Proxy objects allow calls to members of an object to be intercepted without modifying the code of the class. Both classes and interfaces can be proxied, however only virtual members can be intercepted.


  • Proxy instance generator, for intercept.
  • Decorator generator.
  • Proxy instance generator, for control instancing real implementation (e.g. lazy loading).

The following platforms are supported:

  • .Net 4.0, 4.5, 4.6, 4.6.1, NetStandard 1.6, NetStandard 2.0 and UWP applications (NetStandard 1.4)

Generate decorator

 ProxygGenerator generator = new ProxygGenerator();
 Calculator realInstance = new Calculator();
 ICallableInterceptor interceptor = new CallableInterceptorAdapter((invocation) =>
     Console.WriteLine(" Log: Call method {0}", invocation.MethodName);
         Console.WriteLine(" Log: return: {0}", invocation.ReturnValue ?? "null");
     catch(Exception ex)
         Console.WriteLine(" Log: Exception message: {0}", ex.Message);

 ICalculator decorator = generator.GenerateDecorator<ICalculator>(interceptor, realInstance);

 Console.WriteLine("Before call Add with 2013 and 6");
 int result = decorator.Add(2013, 6);
 Console.WriteLine("Result is {0}", result);

Generate proxy

IInterceptor jsonRpcInterceptor = new InterceptorAdapter((invocation, isDynamic) =>
    Guid requestId = Guid.NewGuid();
    var rcpBody = new
        jsonrpc = "2.0",
        method = invocation.MethodName,
        @params = invocation.Arguments,
        id = requestId.ToString()

    string serialized = Newtonsoft.Json.JsonConvert.SerializeObject(rcpBody);

    //simulate sending and recrive

    Console.WriteLine(" Sending Rpc: {0}", serialized);
    string recText = $"{{\"jsonrpc\": \"2.0\", \"result\": 19, \"id\": \"{requestId.ToString()}\"}}";
    Console.WriteLine(" Rec Rpc: {0}", recText);

    Newtonsoft.Json.Linq.JObject response = Newtonsoft.Json.JsonConvert.DeserializeObject< Newtonsoft.Json.Linq.JObject>(recText);
    invocation.ReturnValue = response["result"].ToObject(invocation.ReturnType);

ProxygGenerator generator = new ProxygGenerator();

ICalculator calcilator = generator.GenerateProxy<ICalculator>(jsonRpcInterceptor);

int resultModulo = calcilator.Modulo(15, 4);

Console.WriteLine("Modulo 15 and 4 is {0}", resultModulo);

int resultProduct = calcilator.Product(8, 486);

Console.WriteLine("Product 8 and 486 is {0}", resultProduct);

Generate instance proxy

IInstanceProvicer instanceProvider = new LazyInstanceProvider<ICalculator>(
    () =>
        Console.WriteLine(" Log: Create Calculator.");
        return new Calculator();
    }, false);

ProxygGenerator generator = new ProxygGenerator();
ICalculator  calculator = generator.GenerateInstanceProxy<ICalculator>(instanceProvider);

Console.WriteLine("Before call Add with 2013 and 6");
int result = calculator.Add(2013, 6);
Console.WriteLine("Result is {0}", result);

Console.WriteLine("Before call Product with 2013 and 6");
int result2 = calculator.Product(2013, 6);
Console.WriteLine("Result is {0}", result2);
Product 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 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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.4 is compatible.  netstandard1.5 was computed.  netstandard1.6 is compatible.  netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 is compatible.  net461 is compatible.  net462 was computed.  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 tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on MassiveDynamicProxyGenerator:

Package Downloads

MassiveDynamicProxyGenerator.SimpleInjector is library of extensions method for IoC container - Simple Injector. Adding methods for register mock implementations, proxys, instance proxies for resolving circular depndencies or lazy initialization and interpetion for decoration instances.


A type-safe REST library


MassiveDynamicProxyGenerator Microsoft.Extensions.DependencyInjection is intergration MassiveDynamicProxyGenerator to standard IoC container in ASP.NET Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.7.0 579 11/15/2023
1.5.0 34,607 11/24/2020
1.4.0 7,732 8/27/2019
1.3.0 4,063 7/10/2018
1.3.0-preview1 1,640 5/8/2018
1.2.2 2,028 4/14/2018
1.2.1 1,984 8/21/2017
1.2.0 2,099 6/28/2017
1.2.0-beta1 1,728 6/13/2017
1.1.0 1,906 3/22/2017
1.0.0 1,957 12/1/2016

Change interface IInvocation.
Add universal async ibterceptor CallableInterceptorAsyncAdapter as abstract class for handle error in async task.
Add support for .Net Stdard 2.0.