DotNetDynamicInjector
1.0.0
外部プロジェクトDLLの動的依存関係インジェクター
プロジェクトに追加する必要なく、外部DLLを動的に参照します。プロジェクトを低い依存関係に残し、ビジネスルールまたはデータベースパラメーターに従って特定のDLLを許可します。
情報
| コード品質 | 建てる | ヌゲット | 貢献者 |
|---|---|---|---|
プラットフォームサポート
dotnet.dynamicInjectorは.NET標準2.0ライブラリです。
DynamicInjectorを使用します
デフォルトで参照する必要があるDLLは、コンパイルされたプロジェクトフォルダーにある必要があります
ASP.NETコアプロジェクトのスタートアップでサービス構成を使用する
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 ) ;サンプルが間もなく登場します。