You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

MZNetwork.AutoDependency.CodeGen

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

MZNetwork.AutoDependency.CodeGen

Package Description

1.0.7.1
nugetNuGet
Version published
Maintainers
1
Created
Source

MZNetwork.AutoDependency.CodeGen

Description

Helps to eliminate simple boilerplate code to set up dependency injection.

Setup

  • Add MZNetwork.AutoDependency.CodeGen nuget to your project.
  • Add the following to the .csproj file:
<ItemGroup>
		<!-- Add this to an existing or new ItemGroup. -->
		<CompilerVisibleProperty Include="RootNamespace" />
		<!-- [... Other lines go here ...]
</ItemGroup>
  • Add [Inject] to any class you want to add as a dependency:

    • Optional Parameters include Inject(scopeType=GeneratedDependencytype.Singleton, implementsType=typeof(IInterface), key="KeyedDependencyName")
    • GeneratedDependencyType is an enum with values: Scoped(default), Transient, Singleton
  • In the AppBuilder for the dotnet app call AddGeneratedDependencies(). This will add the dependencies to the IServiceCollection.

This is still under active development so I may modify the system further if other requirements arise.

Keywords

FAQs

Package last updated on 14 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts