Skip to content

failed to register IUnitOfWork using containerRegistry #2330

Answered by dansiegel
ErwinDraconis asked this question in WPF
Discussion options

You must be logged in to vote

@ErwinDraconis while Prism's container can generally resolve concrete types there are a few things that you probably want to adjust here...

First of all, unless you're a DI guru, you really want to avoid using Scoped Services. That is a VERY advanced topic. Remember that Microsoft.Extensions.DependencyInjection was purpose built for ASP.NET where Scoped lifetimes make a lot of sense as each request represents a different user. In the Desktop or Mobile world, you have a single user, and more than likely want a Singleton or a Transient. For your IUnitOfWork and IUserRepository you probably want RegisterSingleton not RegisterScoped.

By not registering the concrete DatabaseContext you are imp…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ErwinDraconis
Comment options

@ErwinDraconis
Comment options

@dansiegel
Comment options

@ErwinDraconis
Comment options

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