DotNetDynamicInjector
1.0.0
หัวฉีดพึ่งพาแบบไดนามิกสำหรับ DLLS โครงการภายนอก
อ้างอิง DLL ภายนอกแบบไดนามิกโดยไม่จำเป็นต้องเพิ่มลงในโครงการ ปล่อยให้โครงการของคุณมีการพึ่งพาต่ำและอนุญาตให้ DLL เฉพาะตามกฎธุรกิจหรือพารามิเตอร์ฐานข้อมูลของคุณ
ข้อมูล
| คุณภาพรหัส | สร้าง | นูเกต | ผู้มีส่วนร่วม |
|---|---|---|---|
การสนับสนุนแพลตฟอร์ม
Dotnet.DynamicInjector เป็นไลบรารี. NET มาตรฐาน 2.0
ใช้ DynamicInjector
DLL ที่ควรอ้างอิงโดยค่าเริ่มต้นจะต้องอยู่ในโฟลเดอร์โครงการที่รวบรวม
ใช้การกำหนดค่าบริการในการเริ่มต้นโครงการ ASP.NET CORE ของคุณ
services . RegisterDynamicDependencies ( ioCConfiguration ) ;IOCConfiguration มีการกำหนดค่าการฉีดขึ้นอยู่กับการพึ่งพาของคุณ เป็นไปได้ที่จะระบุเฉพาะเนมสเปซที่คุณต้องการอ้างอิงโดยไม่สนใจผู้อื่นในโครงการ
var ioCConfiguration = new IoCConfiguration ( )
{
AllowedInterfaceNamespaces =
new List < string > { "Mynamespance1" , "Mynamespance2" }
} ;IOCROLE กำหนดค่า DLL และประเภทของการพึ่งพาที่คุณต้องการฉีดโดยอัตโนมัติ
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 ) ;ตัวอย่างเร็ว ๆ นี้ ..