-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why IHost? #1
Comments
This is purely a trimmed down example taken from a WinUI3 app I have. You are correct that if you want to just manage dependencies then go with the IServiceProvider approach. At the time this was posted there was hardly any documentation of what the best practice was to implement DI in an Avalonia app. This implementation is commonly used in Desktop apps and follows best practices. Using the IHost enables me to easily read config files, run background services using IHostedService. Just to appease I've added AppHost.Start() method. |
Thanks for the clarification, I discovered your repository while looking for a good Avalonia's DI guides. The official documentation is not helpful at all: AvaloniaUI/avalonia-docs#525 |
No, thank you for taking the time to investigate this repo and giving your thoughts. |
Hello, I'm not sure if I mis-understand something
The
AppHost.Run()
is not called anywhere. It was always Avalonia which manage the application lifecycle, not theIHost
we created.So what is the point of creating this IHost?
If it serves only for DI, then isn't it better to replace this IHost with a more appropriated interface
IServiceProvider
?The text was updated successfully, but these errors were encountered: