-
[WPF] IOC, IServiceProviderC#/WPF 2024. 1. 26. 09:56
Ioc Container 는 Resolve(=GetInstance)하면 locked 걸리면선 Register안됨.
Register 할거 있으면 먼저 다 하고 Resolve 진행. (=> Resolve 는 IServiceProvider의 기능이라고 보면 됨.)
IServiceProvider (=> 서비스릉 등록하고 Get하는 등. 생성자에 주입하는 기능등.)
Ioc Container에 등록된 서비스는 Constructor DI 가능.
ex)
Register DoucumentModule 서비스
customContainer.RegisterSingleton<IDocumentModule, DocumentModule>();
Constructor Di
public ModuleAViewModel(IDocumentModule documentModule) { this.documentModule = documentModule; Caption = this.documentModule.Caption ?? Caption; IsActive = this.documentModule.IsActive; ModuleATextBlockChangeCommand = new DelegateCommand(ExecuteChangeText, IsChangeText); }
IServiceProvider
Using .NET Core 3.0 Dependency Injection and Service Provider with WPF
UPDATE: this article is based on a preview release of .NET Core 3.0. Please refer to Update on using HostBuilder, Dependency Injection and Service Provider with .NET Core 3.0 WPF applications for t…
marcominerva.wordpress.com
https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/ioc
Ioc - Community Toolkits for .NET
An introduction to the use of the IServiceProvider type through the Microsoft.Extensions.DependencyInjection APIs
learn.microsoft.com
https://forum.dotnetdev.kr/t/wpf/8143
wpf 의존성 주입 컨테이너 관련 질문 있습니다.
보통 의존성 주입을 위해 서비스를 등록하고 GetRequiredService<>()를 통해 의존성 주입이 일어난다고 알고있는데 이 부분이 맞는지 알고싶습니다. 그리고 App.xmal의 코드 비하인드에서 DataContext = s.Get
forum.dotnetdev.kr
IOC 성능 비교
https://github.com/danielpalme/IocPerformance
GitHub - danielpalme/IocPerformance: Performance comparison of .NET IoC containers
Performance comparison of .NET IoC containers. Contribute to danielpalme/IocPerformance development by creating an account on GitHub.
github.com
DevExpress Ioc 사용
GitHub - DevExpress-Examples/wpf-mvvm-framework-register-poco-type-in-dependency-injection-container: This example illustrates h
This example illustrates how to register a POCO View Model in a various Dependency Injection containers - GitHub - DevExpress-Examples/wpf-mvvm-framework-register-poco-type-in-dependency-injection-...
github.com
728x90'C# > WPF' 카테고리의 다른 글
[WPF] ViewModel에서 View의 함수 호출하기 (0) 2024.02.22 [WPF] Icon Image Binding Runtime (0) 2024.02.05 [WPF] 어셈블리에서 로드한 정보로 인스턴스 생성. (0) 2024.01.26 [WPF] Reduce WPF App Startup Time (0) 2024.01.16 [WPF] App.config (0) 2024.01.09 댓글