BE.Auto.Dependency
1.0.0
dotnet add package BE.Auto.Dependency --version 1.0.0
NuGet\Install-Package BE.Auto.Dependency -Version 1.0.0
<PackageReference Include="BE.Auto.Dependency" Version="1.0.0" />
paket add BE.Auto.Dependency --version 1.0.0
#r "nuget: BE.Auto.Dependency, 1.0.0"
// Install BE.Auto.Dependency as a Cake Addin #addin nuget:?package=BE.Auto.Dependency&version=1.0.0 // Install BE.Auto.Dependency as a Cake Tool #tool nuget:?package=BE.Auto.Dependency&version=1.0.0
BE.Auto.Dependency
Overview
The BE.Auto.Dependency
module simplifies dependency injection in your application by automating the registration of services using the ASP.NET Core Dependency Injection framework.
Usage
To integrate automatic dependency registration, add the following code in your application startup:
builder.Services.AddAutoDependency();
Example Service Implementation Consider the implementation of a service, UserAppService, as an example:
public class UserAppService : IUserAppService
{
public async Task<bool> UpdateProfilePictureAsync(IFormFile file)
{
if (file.Length == 0)
return false;
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "uploads", file.FileName);
await using var stream = new FileStream(filePath, FileMode.Create);
await file.CopyToAsync(stream);
return true;
}
public async Task<string> GetUserNameAsync()
{
return await Task.FromResult("Burak ESER");
}
}
Service Interfaces Define service interfaces that extend IApplicationService:
public interface IUserAppService : IApplicationService
{
Task<bool> UpdateProfilePictureAsync(IFormFile file);
Task<string> GetUserNameAsync();
}
public interface IApplicationService : ITransientDependency
{
}
Lifetimes and Attributes The module supports the following lifetimes:
ITransientDependency ISingletonDependency IScopedDependency Attributes for lifetimes include:
ScopedDependencyAttribute SingletonDependencyAttribute TransientDependencyAttribute
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 219 | 11/16/2023 |