Тёмный

Adding Dependency Injection to WPF applications 

Codewrinkles
Подписаться 29 тыс.
Просмотров 10 тыс.
50% 1

Опубликовано:

 

29 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@dominikkownacki8235
@dominikkownacki8235 4 месяца назад
While watching your video, I could add DI to my wpf app and it worked! Great job
@onestop7942
@onestop7942 3 года назад
Very nicely explained. Thankyou so much, it helped me a lot in understanding many things. Thanks
@Codewrinkles
@Codewrinkles 3 года назад
Glad to hear that
@ZivaSila
@ZivaSila 3 года назад
Thanks! Waiting for the next video you mentioned.
@2005bgva
@2005bgva 2 года назад
Thanks, it was fantastic, maybe do you have a playlist with a complete aplication with DB interaction?
@ken30096
@ken30096 2 года назад
This was a good video. I know you are busy but it would be nice to have the follow-up video that you mentioned.
@Codewrinkles
@Codewrinkles 2 года назад
First of all, thank you very much for dropping this comment. Feedback is always welcome. Regarding the follow-up, I didn't create it due to lack of time. What I try to do in this channel is mostly creating videos on things that I actively work on during my day to day job. I think that this is a point that sets this channel out when compared to others. I try to not just create tutorials, but create videos that actually start from real applications as this is what I think brings value to viewers. Unfortunately, I didn't get to continue the work on a .NET Core WPF app so that's why the follow-up is missing. I'll try however to plan it for within the next month.
@hassanhilaly8810
@hassanhilaly8810 2 года назад
I learned a lot from this video , thank you very much sir.
@iancarr3923
@iancarr3923 3 года назад
Very useful, thanks!
@2005bgva
@2005bgva 2 года назад
I would like to know if you do more videos for WPF with .NET 6? for .NET6 is correct to still use "Microsoft.Extensions.Hosting" or there are a better alternative?
@nonstop150
@nonstop150 Год назад
Thank you very much!
@Codewrinkles
@Codewrinkles Год назад
You're welcome!
@VinaAutoSys
@VinaAutoSys 3 года назад
Thanks so much! Could you help me to explain how to to adding DI to another more Window than MainWindow ?
@ВладимирЛяпунов-у3к
Thank you sir, this does help me out a lot
@faridulhuk1248
@faridulhuk1248 2 года назад
Hi Sir, Thank you very much for the nice tutorial, can you please put video on handling multiple pages using DI. I am having problem hiding one page and opening other page.
@wvvwwwvvw
@wvvwwwvvw 2 года назад
So I assume that in case of MVVM, you would also need to register the ViewModels as singleton, in case they have those services passed in as arguments in the ctor?
@rmsoft
@rmsoft Год назад
I depends. If you have dialog windows, you can register Transient. Actually you can replace Singleton to Scoped when using WPF.
@PPlayUZB
@PPlayUZB 3 года назад
Thank you !
@alexanderryzhov
@alexanderryzhov 2 года назад
The example shows how you should not use wpf. Here's not about mvvm, inject service directly into view is antipattern
@Codewrinkles
@Codewrinkles 2 года назад
Thank you very much for your feedback. I don't really disagree with your argument, but on the other side it shows a certain misunderstanding of the topic of the video itself. This video was created shortly after WPF got ported to the .NET Core family and DI was suddenly possible almost out of the box (and, yes, DI should be used even in WPF apps). The video then just shows how to setup the .NET Core DI container in a WPF application and how you can resolve services where you need them. It was just a demo of a new feature/possibility. Nobody promoted this as being a best practice and a way to follow. On the other hand even Microsoft docs, or DevExpress docs clearly state that DI can be used in View to resolve ViewModels and by ViewModels to resolve the needed services. I'm for sure not an expert on this topics, but my experience shows me that a lot of things in software engineering are not as black or as white as we sometimes tend to make them look.
@rmsoft
@rmsoft Год назад
Well, it is an example of using DI, not MVVM and as such is fully acceptable.
@alexbotinok9314
@alexbotinok9314 2 года назад
You can also create a XAML markup extension to assign DataContext with injected parameters to your view: community.devexpress.com/blogs/wpf/archive/2022/02/07/dependency-injection-in-a-wpf-mvvm-application.aspx
@Llejean
@Llejean 4 года назад
Mvvm with Prism is interesting for wpf
@Codewrinkles
@Codewrinkles 4 года назад
I'm familiar with the MVVM architectural pattern, though I'm not sure if I would use a library for that. This being said, that's clearly an aspect I still have to learn more about and research more thoroughly. But I still think that using the #DotNetCore DI container might be useful.
@Llejean
@Llejean 4 года назад
​@@Codewrinkles Yes deffinitly, in .net framework it was unitycontainer and consorts but I quess they will fade away now that .net core has it's own container. Prism is more for modularity and navigation, but never tried in in .net core.
@ekkalchev
@ekkalchev Год назад
What you show only work for Windows child classes. WPF apps are composed of many other UserControls and Controls child classes. They must have parameter less constructor in order to be instantiated by XAML parser. You are not giving solution for this and the title of the video is misleading. I would like to show me how to inject dependency into custom TextBox control.
Далее
Dependency Injection, Generic Host, and WPF
2:44:29
Просмотров 7 тыс.
ХУДШИЕ ВЫБОРЫ в США
13:20
Просмотров 458 тыс.
Dependency Injection
45:17
Просмотров 147 тыс.
.NET Core Dependency Injection - Tips and Tricks
13:08
Просмотров 2,6 тыс.
How to Implement Validation in WPF MVVM
47:07
Просмотров 8 тыс.
Brutally honest advice for new .NET Web Developers
7:19
What is Dependency Injection?
6:48
Просмотров 118 тыс.
Dependency Injection Is Now Complete In .NET 8!
9:49
ХУДШИЕ ВЫБОРЫ в США
13:20
Просмотров 458 тыс.