Viewmodel as ILogEventSink in a Prism application

16 Views Asked by At

I would like to use a ViewModel as a LogSink (ILogEventSink) in a Prism 8 application. Additionally I would like being able to use regions and navigation the normal way which, I believe, means that the View and corresponding ViewModel must be registered in the container like other Views/ViewModels (containerRegistry.RegisterForNavigation() etc.) as well as keeping the ViewModelLocator.AutoWireViewModel mechanism intact. The ViewModel (LogSink) has several dependencies which should be injected by the Prism container (Unity or DryIoc).

The sink registering is normally (must be?) done by implementing an extension method on the LoggerSinkConfiguration. The question then is how to do the sink registering when the Sink must be resolved by the container and the arguments of the extension method (ITextFormatter etc.) must be injected?

0

There are 0 best solutions below