Skip to content

Confused about Scoped registrations in Prism IoC #2655

Answered by dansiegel
bzuillsmith asked this question in General
Discussion options

You must be logged in to vote

Scoping in Prism is only implemented within Prism.Forms. In this case the scope is set to the Page. Each Page has its own scope. For WPF & Uno we do not deal with creating scopes and this becomes the burden of the developer.

Prism does not implement registrations on a child container as this goes against our established patterns and recommendations. You should configure the container at application startup / via Prism Modules.

containerRegistry.RegisterScoped<IFoo, Foo>();

For context you should consider the following when trying to determine what registration is best.

  1. Does my service need to exist and be the SAME EXACT instance everywhere in my application? Then it should be a Singleton
  2. I…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@ssingh-cemtrex
Comment options

Comment options

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

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