Dynamische Abhängigkeitsinjektor für externe Projektdlls
Verweisen Sie dynamisch auf externe DLLs, ohne dass sie dem Projekt hinzugefügt werden müssen. Lassen Sie Ihr Projekt mit geringer Abhängigkeit und erlauben Sie bestimmte DLLs gemäß Ihrer Geschäftsregel oder Datenbankparameter.
Info
| Codequalität | Bauen | Nuget | Mitwirkende |
|---|---|---|---|
Plattformunterstützung
Dotnet.Dynamicinjector ist eine .NET Standard 2.0 -Bibliothek.
Verwenden von Dynamicinjector
Die standardmäßigen DLLs, auf die sich standardmäßig beziehen sollte, müssen sich im zusammengestellten Projektordner befinden
Verwenden Sie die Servicekonfiguration im Start Ihres ASP.NET -Kernprojekts
services . RegisterDynamicDependencies ( ioCConfiguration ) ;IocConfiguration enthält die Konfiguration Ihrer Abhängigkeitsinjektion. Es ist möglich, nur die Namespaces anzugeben, auf die Sie sich verweisen möchten, und ignorieren andere im Projekt
var ioCConfiguration = new IoCConfiguration ( )
{
AllowedInterfaceNamespaces =
new List < string > { "Mynamespance1" , "Mynamespance2" }
} ;IOCROLE konfiguriert die DLL und die Art der Abhängigkeit, die Sie automatisch injizieren möchten
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 ) ;Proben kommen bald ..