.NET and ASP.NET Core 10 · ASP.NET Core code
Register a service
Add a class to dependency injection with a scoped lifetime.
builder.Services.AddScoped<IUserService, UserService>();
Official .NET and ASP.NET Core 10 documentation
More asp.net core code commands
- Write a minimal API
- Read configuration
- Set up user secrets
- Store a development secret
- Add authentication and authorization
- Map controllers
All asp.net core code commands · .NET and ASP.NET Core 10 cheatsheet