MicrosoftDocs / WindowsCommunityToolkitDocs

Creative Commons Attribution 4.0 International
179 stars 156 forks source link

Registering an additional service at a later time #628

Open Shujee opened 2 years ago

Shujee commented 2 years ago

Coming from MVVM Light, I could use Register() method at any time during the life of my application. This allowed me to register new behaviors/override existing registrations in referenced projects. For example, I could register a default/dummy implementation of IDialogService in the VM layer (static constructor of ViewModelLocator) and then override this registration in the View layer with an actual discrete implementation.

This no longer seems possible with the CommunityToolkit. There is a single ConfigureServices that I must call upon startup, in the VM layer. What do I do in the View layer to re-register/override an existing registration?