Using smart modules in .NET 6 minimal API

preview_player
Показать описание
The minimal API in .NET 6 is great because it is less opinionated than the controller based approach and hence it gives us more freedom to organize our code differently. One approach that we think might be very useful is the module based approach. We can just organize our different features into self-contained modules (similar to Angular modules, for instance).

To achieve this there is a nice, small NuGet package called SmartModules. When using this package we can easily create module classes by implementing the IModule interface. The library will then automatically register all our endpoints in the different modules that we might have in an application.

In this video we showcase how to get started with SmartModules in .NET 6 minimal APIs, going through different concepts like modules, endpoint definitions and dependency injection.
#dotnet6 #aspnetcore #csharp

Chapters
1. Intro: 00:00
2. Meet the SmartModules NuGet package: 01:50
3. Creating a first module: 03:30
4. Adding necessary services and automatic route registrations: 06:46
5. Splitting registrations in different endpoint definitions: 08:36
6. Dependency injection in smart modules: 15:00
7. Injecting scoped services in modules or endpoint definitions: 17:05
Рекомендации по теме
Комментарии
Автор

I always got frustrated with dotnet videos. All stuff uses visual studio. Im on another platform and cant use it. Makes no sense dotnet 6 be multiplatform and all examples use a tool thats not.

jcbritobr
visit shbcf.ru