Skip to content
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

Add IContainerProvider to IModule.OnInitialized #1338

Closed
dansiegel opened this issue Jan 19, 2018 · 1 comment
Closed

Add IContainerProvider to IModule.OnInitialized #1338

dansiegel opened this issue Jan 19, 2018 · 1 comment
Labels

Comments

@dansiegel
Copy link
Member

Description

OnInitialized can become challenging to use as IContainerProvider is not available, making it harder than it should be to resolve a service that you may need in OnInitialized. The signature should be updated to include IContainerProvider.

Expected Behavior

public void OnInitialized(IContainerProvider containerProvider)
{
   containerProvider.Resolve<ISomeService>();
}

Actual Behavior

private IContainerProvider Container;

public void OnInitialized()
{
    Container.Resolve<ISomeService>();
}

public void RegisterTypes(IContainerRegistry containerRegistry)
{
    Container = (IContainerProvider)containerRegistry;
    containerRegistry.RegisterForNavigation<ViewA>():
}

Basic Information

  • Version with issue: 7.0
  • Last known good version: n/a
  • Xamarin.Forms version: 2.5
  • IDE: n/a
@lock
Copy link

lock bot commented Jan 29, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants