Skip to content
Discussion options

You must be logged in to vote

based on the code that you've shared, I would suggest adding the IEventAggregator as a parameter of your CommonState.Start.

protected override void OnStart()
{
    var ea = Container.Resolve<IEventAggregator>();
    CommonState.Start(ea);
}

If that is not an option because you absolutely have to use this from a completely static context where you cannot so easily access the container, and you have no other option other than to use a Service Locator pattern, then as long as you're using Prism 8+ you can use the ContainerLocator.

public void Start()
{
    var ea = ContainerLocator.Container.Resolve<IEventAggregator>();
} 

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@pystudy123
Comment options

Comment options

You must be logged in to vote
1 reply
@pystudy123
Comment options

Answer selected by pystudy123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants