1) The ServiceProvider is created and available only inside the function OnFrameworkInitializationCompleted(), while it should be generally accessible to create object for us anywhere. Or How to make the avalonia framework use our ServiceProvider when creating object?
2) Is it really neccessary to Register the services (a.k.a the ServiceCollection) inside OnFrameworkInitializationCompleted()? We are registering the services, not actually create or use them, so why do we need to wait for OnFrameworkInitializationCompleted?
Hello,
The current example in the guide is not very helpful
https://docs.avaloniaui.net/docs/guides/implementation-guides/how-to-implement-dependency-injection
1) The
ServiceProvider
is created and available only inside the functionOnFrameworkInitializationCompleted()
, while it should be generally accessible to create object for us anywhere. Or How to make the avalonia framework use our ServiceProvider when creating object?2) Is it really neccessary to Register the services (a.k.a the
ServiceCollection
) insideOnFrameworkInitializationCompleted()
? We are registering the services, not actually create or use them, so why do we need to wait forOnFrameworkInitializationCompleted
?My suggesstion is