Register services according to container with service lifetime attributes
Install package from nuget.org
NuGet\Install-Package JFA.DependencyInjection -Version <VERSION>
Add lifetime attribute to service implementations
[Scoped]
public class UsersService : IUsersService
{...}
[Transient]
public class ProductsService : IProductsService
{...}
[Singleton]
public class OrdersService : IOrdersService
{...}
Add following line to Program.cs file
builder.Services.AddServicesFromAttribute();
Now you can inject services
public UsersController(IUsersService usersService)
{...}