In this video we will see how to use dependency injection with Blazor in .NET. The video shows Blazor Server, but this works the same way in Blazor WebAssembly and even ASP.NET (Core). We will learn about the different scopes like singleton and see how to inject on Razor pages.

🔗 Links
Sample Code Repo: https://github.com/jfversluis/BlazorDISample
Dependency Injection Basics Video: https://www.youtube.com/watch?v=tTJetZj3vg0

Blazor: https://blazor.net
Blazor Docs: https://blazor.net/docs

⏱ Timestamps
0:00 Intro
0:18 Preview End Result
0:52 Inspect Sample App
1:35 Register Dependencies & Scopes
3:40 Implement Dependency Injection Sample with Singleton
5:45 Construction Injection
6:30 Inject in Razor Pages
7:42 Running the Sample App
8:40 Change to Scoped
9:00 Sample App with Scoped
9:35 When To Use Which Scope?
10:20 Outro

#blazor #webassembly #aspnet #csharp #dotnet

Dependency Injection with .NET Blazor
1.70 GEEK