Dependo.LightInject 1.2.3

dotnet add package Dependo.LightInject --version 1.2.3
                    
NuGet\Install-Package Dependo.LightInject -Version 1.2.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dependo.LightInject" Version="1.2.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dependo.LightInject" Version="1.2.3" />
                    
Directory.Packages.props
<PackageReference Include="Dependo.LightInject" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dependo.LightInject --version 1.2.3
                    
#r "nuget: Dependo.LightInject, 1.2.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Dependo.LightInject@1.2.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dependo.LightInject&version=1.2.3
                    
Install as a Cake Addin
#tool nuget:?package=Dependo.LightInject&version=1.2.3
                    
Install as a Cake Tool

<img src="https://github.com/gordon-matt/Dependo/raw/master/_Misc/Logo.png" alt="Logo" width="250" />

Intro

Dependo is a library that let's you resolve dependencies from anywhere via a singleton call to DependoResolver.Instance. This is mostly useful for resolving dependencies in static classes, including extensions methods.

Additionally, there is an IDependencyRegistrar interface to let you register dependencies from anywhere, such as class libraries. If you need to take advantage of implementation-specific registration features, you can make use of the more specialized dependency registrar, such as IAutofacDependencyRegistrar, IDryIocDependencyRegistrar, etc.

Check the demo project for a clearer idea on how to use Dependo. Or for a more advanced example, see it being used in MantleCMS

NuGet Packages

Package Version Downloads
Dependo NuGet NuGet
Dependo.Autofac NuGet NuGet
Dependo.DotNetDefault NuGet NuGet
Dependo.DryIoc NuGet NuGet
Dependo.Lamar NuGet NuGet
Dependo.LightInject NuGet NuGet

Feature Support

The default .NET implementation suits most needs. You could start with that and then if more advanced features are required, simply swap out that implementation for another. Use the following table to help decide which is most suitable for your project.

Method Default .NET DI Autofac DryIoc Lamar LightInject
IsRegistered(Type serviceType) ✅ ✅ ✅ ✅ ✅
Resolve<T>() ✅ ✅ ✅ ✅ ✅
Resolve<T>(IDictionary<string, object> ctorArgs) ❌ ✅ ✅ ❌ ❌
object Resolve(Type type) ✅ ✅ ✅ ✅ ✅
T ResolveKeyed<T>(object key) ✅ ✅ ✅ ✅ ✅
T ResolveKeyed<T>(object key, IDictionary<string, object> ctorArgs) ❌ ✅ ✅ ❌ ❌
IEnumerable<T> ResolveAllKeyed<T>(object key) ✅ ✅ ❌ ❌ ❌
IEnumerable<T> ResolveAll<T>() ✅ ✅ ✅ ✅ ✅
IEnumerable<T> ResolveAllNamed<T> ✅ ✅ ❌ ❌ ❌
T ResolveNamed<T>(string name) ✅ ✅ ✅ ✅ ✅
T? ResolveUnregistered<T>() ✅ ✅ ✅ ✅ ✅
object ResolveUnregistered(Type type) ✅ ✅ ✅ ✅ ✅
bool TryResolve<T>(out T? instance) ✅ ✅ ✅ ✅ ✅
bool TryResolve(Type serviceType, out object? instance) ✅ ✅ ✅ ✅ ✅

Credits

I based the original version of this project on some code found in an old version of nopCommerce. They only used Autofac; I wanted it to be more generic for use in projects where the IOC container may need to be swapped out for another implementation.

Support

If you find this project useful, consider supporting its development.

<p align="center"> <a href="https://buymeacoffee.com/vnmatt"> <img src="https://github.com/gordon-matt/MyResume/blob/gh-pages/assets/images/BuyMeACoffee_Logo.png" alt="Buy Me a Coffee" height="40"> </a>    <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=gordon_matt%40live%2ecom&lc=AU&currency_code=AUD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"> <img src="https://github.com/gordon-matt/MyResume/blob/gh-pages/assets/images/PayPal_Logo.png" alt="Donate with PayPal" height="40"> </a> </p>

<p align="center"> Prefer using your phone? Scan the QR code: </p>

<p align="center"> <a href="https://buymeacoffee.com/vnmatt"> <img src="https://github.com/gordon-matt/MyResume/blob/gh-pages/assets/images/BuyMeACoffee_QR.png" alt="Buy Me a Coffee QR Code" width="180"> </a> </p>

<img src="https://komarev.com/ghpvc/?username=gordon-matt&label=GitHub%20Hits%20Since%202025-06-01%3A%20&color=ff0000&style=flat" alt="gordon-matt" />

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Dependo.LightInject:

Package Downloads
MantleFramework.Infrastructure.LightInject

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.3 48 11/5/2026
1.2.2 101 10/23/2026
1.2.0 366 11/14/2025
1.1.2.1 296 5/25/2025