MassiveDynamicProxyGenerator.SimpleInjector 1.3.0-preview1

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

// Install MassiveDynamicProxyGenerator.SimpleInjector as a Cake Tool
#tool nuget:?package=MassiveDynamicProxyGenerator.SimpleInjector&version=1.3.0-preview1&prerelease

MassiveDynamicProxyGenerator.SimpleInjector

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.

Register mock

using MassiveDynamicProxyGenerator.SimpleInjector;

Container container = new Container();
container.RegisterMock<IMessageService>();

Register proxy instances

using MassiveDynamicProxyGenerator.SimpleInjector;

Container container = new Container();
InterceptorAdapter adapter = new InterceptorAdapter(invodcation =>
{
     if (invodcation.MethodName == nameof(IMessageService.GetCountOfMessagesInFront))
     {
          invodcation.ReturnValue = 42;
     }
});

container.RegisterProxy(typeof(IMessageService), adapter);

Register decorators using interception

using MassiveDynamicProxyGenerator.SimpleInjector;

Container container = new Container();
CallableInterceptorAdapter adapter = new CallableInterceptorAdapter((invodcation) =>
{
    invodcation.Process();
    if (invodcation.MethodName == nameof(IMessageService.GetCountOfMessagesInFront))
    {
       invodcation.ReturnValue = 42;
    }
});

container.RegisterInterceptedDecorator(adapter, t => !t.Name.StartsWith("IType"));

Register instance provider

using MassiveDynamicProxyGenerator.SimpleInjector;

Container container = new Container();
container.RegisterInstanceProxy<IMessageService>(() => new MessageService());

Dangerous extensions for mock all unregistred types

using MassiveDynamicProxyGenerator.SimpleInjector;
using MassiveDynamicProxyGenerator.SimpleInjector.Dangerous;

Container container = new Container();
container.RegisterAllUnregistredAsMock();

Dangerous extension for instance provider

This extenions using only with cope lifestyle.

using MassiveDynamicProxyGenerator.SimpleInjector;
using MassiveDynamicProxyGenerator.SimpleInjector.Dangerous;

Container container = new Container();

internal class WeekInstanceProvider : IInstanceProvicer
{
   private WeakReference<ITypeA> reference;
   private object syncRoot;

   public WeekInstanceProvider()
   {
      this.reference = new WeakReference<ITypeA>(null);
      this.syncRoot = new object();
   }
  
   public object GetInstance()
   {
       IMessageService instance = null;
       lock (this.syncRoot)
       {
          reference.TryGetTarget(out instance);
          if (instance == null)
          {
             instance= new MessageService();
             reference.SetTarget(instance);
          }
       }

        return instance;
    }
        
    public void Dispose()
    {
    }
}

container.RegisterInstanceProxy<IMessageService>(new WeekInstanceProvider());
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 (1)

Showing the top 1 NuGet packages that depend on MassiveDynamicProxyGenerator.SimpleInjector:

Package Downloads
SoftAPIClient

A type-safe REST library

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.0 30,312 11/24/2020
1.4.0 5,639 8/27/2019
1.3.0 930 7/10/2018
1.3.0-preview1 791 5/8/2018
1.2.2 1,046 4/14/2018
1.2.1 1,041 8/21/2017
1.2.0 1,031 6/28/2017
1.2.0-beta1 906 6/13/2017

Add support for .Net Stdard 2.0.
Update simple Injector nugets.