AutoResolver 1.0.0
See the version list below for details.
dotnet add package AutoResolver --version 1.0.0
NuGet\Install-Package AutoResolver -Version 1.0.0
<PackageReference Include="AutoResolver" Version="1.0.0" />
paket add AutoResolver --version 1.0.0
#r "nuget: AutoResolver, 1.0.0"
// Install AutoResolver as a Cake Addin #addin nuget:?package=AutoResolver&version=1.0.0 // Install AutoResolver as a Cake Tool #tool nuget:?package=AutoResolver&version=1.0.0
AutoResolver
AutoResolver is a simple little library built to resolve classes bit more easily. Any class or interface can implement the following interfaces to register their class and resolve them in constructor or through service provider.
IResolveTransient
to register the class with lifetime as transient.IResolveScoped
to register the class with lifetime as scoped.IResolveSingleton
to register the class with lifetime as singleton.
How do I get started?
First add the AutoResolver to the service collection.
...
services.AddAutoResolver();
services.AddMvc();
services.AddJwtTokenAuthentication();
....
OR
var serviceProvider = new ServiceCollection()
.AddAutoResolver()
.BuildServiceProvider();
Then implement the desired interface to register them with Microsoft.Extensions.DependencyInjection
.
using AutoResolver;
namespace AutoResolverTest
{
public interface IResolveAsTransient : IResolveTransient
{
string GetMessage();
}
}
...
namespace AutoResolverTest
{
public class ResolveAsTransient : IResolveAsTransient
{
public string GetMessage()
{
return "This class has been resolved successfully";
}
}
}
Now you are done. You can now use the service provider (or constructor injection) to resolve the class.
var myResolvedClass = serviceProvider.GetRequiredService<IResolveAsTransient>();
Console.WriteLine($"Text from resolved class: {myResolvedClass.GetMessage()}");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- Microsoft.Extensions.DependencyInjection (>= 5.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.