chuckp
chuckp

Reputation: 313

Using WPF and Prism, how to resolve a dependency not using constructor injection

In a ViewModel, is there a way to resolve a dependency using PRISM that is not by contructor injection? In Caliburn Micro you can do something like

_myService = IoC.Get<IMyService>();

but is there a way to do the same thing in PRISM? Example?

Upvotes: 1

Views: 190

Answers (1)

Egor
Egor

Reputation: 1838

PRISM is bundled with Unity and MEF for dependency injection - and both support property injection as well as constructor injection. If you don't want to use constructor injection, you can use the relevant attribute and tag injectable properties.

https://prismlibrary.readthedocs.io/en/latest/WPF/03-Managing-Dependencies/#using-dependency-injection-containers-and-services-in-prism

Upvotes: 1

Related Questions