Dependency Injection with .NET MAUI Explained! Full Beginner's Guide
James Montemagno James Montemagno
138K subscribers
66,039 views
2.1K

 Published On May 5, 2022

.NET MAUI supports the dependency injection (DI) software design pattern, which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies. On top of that it fully supports constructor injection and full dependency resolution when navigating when using Shell. I break down every little thing you need to know about DI, IoC, and constructor injection with .NET MAUI.

Note: That [ICommand] is now [RelayCommand] from the .NET community toolkit!

Links:
Sample Code: https://github.com/jamesmontemagno/Ma...
MVVM Source Generators: https://github.com/jamesmontemagno/MV...
.NET Podcasts App: https://github.com/microsoft/dotnet-p...
.NET MAUI Documentation: https://docs.microsoft.com/dotnet/mau...
Dependency Injection in .NET: https://docs.microsoft.com/dotnet/cor...
Dependency Injection in ASP.NET Core: https://docs.microsoft.com/aspnet/cor...
.NET MAUI Workshop: https://github.com/dotnet-presentatio...

Join this channel to get access to perks:
   / @jamesmontemagno  

👕 Buy some swag! - https://jamesmontemagno.myspreadshop....
☕️ Buy me a coffee - https://www.buymeacoffee.com/jamesmon...

Chapters:
00:00 - Intro
01:15 - What is dependency injection?
04:55 - Source code walkthrough
07:10 - Registering services
09:30 - Resolving services
12:00 - Constructor injection & resolution of dependencies
14:00 - Automatic dependency resolution with Shell
17:08 - Wrap-up

Follow:
👨‍💻 GitHub: https://github.com/jamesmontemagno
🦜 Twitter:   / jamesmontemagno  
📄 Website: https://www.montemagno.com
📰 Newsletter: https://newsletter.montemagno.com/

Disclaimer: This channel, videos, and streams are created in my spare time and are a product of me... James Montemagno! They are NOT officially affiliated or endorsed by Microsoft (my employer) in any way. Opinions and views are my own.

What is on my hat? It is the CLE clothing logo because I am from Cleveland! Checkout their awesome CLE merch: https://cleclothingco.myshopify.com/

What is that art on my wall? It is an original piece from the French street artist Gregos of La Butte Montmartre:   / bcez1onhiqx  

My Setup:
💡 Nanoleaf Elements Lights - https://amzn.to/3umwJVW
🎙 Blue Spark Microphone - https://amzn.to/3qgtYkq
🎙 Blue Pop Filter - https://amzn.to/3jEWM3r
🤳 Rode Microphone Arm - https://amzn.to/2Z68AlE
🎧 Sony MDR7306 Headphones - https://amzn.to/372jxta
📲 Stream Deck - https://amzn.to/373Uk1n
📹 Elgato Cam Link - https://amzn.to/3a9eGbh
📷 GoPro Hero - https://amzn.to/374lm90
🖱 MX Master 2S Mouse - https://amzn.to/3d7J2gj
⌨️ Tecware Phantom Keyboard - https://amzn.to/3aUP4y9

#dotnetmaui #dependencyinjection #dotnet #ios #android #netmaui #maui

show more

Share/Embed