andreluizsecco / DotNetDynamicInjector

πŸ’‰ Dynamically reference external dlls without the need to add them to the project. Leave your project with low dependency and allowing specific dlls according to your business rule or database parameters.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DotNet.DynamicInjector

Dynamic dependency injector for external project DLLs

Dynamically reference external dlls without the need to add them to the project. Leave your project with low dependency and allowing specific dlls according to your business rule or database parameters.

This is the component, works on .NET Core and.NET Framework

Info

Code Quality Build Nuget Contributors
Codacy Badge Build NuGet GitHub contributors

Platform Support

DotNet.DynamicInjector is a .NET Standard 2.0 library.

Using DynamicInjector

The dlls that should be referenced by default must be in the compiled project folder

Use the service configuration in the startup of your ASP.NET core project

services.RegisterDynamicDependencies(ioCConfiguration);

IoCConfiguration contains the configuration of your dependency injection. It is possible to specify only the namespaces you want to reference, ignoring others in the project

var ioCConfiguration = new IoCConfiguration()
{
   AllowedInterfaceNamespaces = 
       new List<string> {"Mynamespance1", "Mynamespance2"}
};

IoCRole configures the dll and type of dependency you want to automatically inject

var role = new IoCRole
 {
     Dll = "MyProject.dll", //DLL name
     Implementation = "My Implementation", // Implementation name, can be used for a control if you use several projects and wanted to separate them
     Priority = 1, // Priority that the dll should be loaded
     LifeTime = LifeTime.SCOPED, // Lifetime of your addiction injection
    Name = "My client business rule x" //Dependency name. It is used only for identification
  };
            
    ioCConfiguration.Roles.Add(role);

Samples coming soon ..

About

πŸ’‰ Dynamically reference external dlls without the need to add them to the project. Leave your project with low dependency and allowing specific dlls according to your business rule or database parameters.


Languages

Language:C# 100.0%