Apr 21

Prism Interview Questions and Answers

11. What is ILoggerFacade? 

ILoggerFacade is an interface used in Prism Framework for logging purpose.

The simplest approach to logging in Prism is to override the LoggerFacade property in your Bootstrapper. By overridding the LoggerFacade, you can pass in an instance of any Logger you want with any configuration needed as long as the logger implements the ILoggerFacade interface.

A simple Example is given below. 

12. What are Region and Region Managers?

In Prism framework, we define the region through XAML code and once a region is defined, automatically it will be registered with the RegionManager. Actually the Bootstrapper registers a service called the RegionManager at run time.

RegionManager is a dictionary where the key is name of the region. The value of the key is the reference of the IRegion interface. RegionAdapter is used to create the instance reference of the IRegion interface.

13. What are MEF and Unity?

Unity is mostly used for static dependencies and is more an “internal” technology, meaning outsiders do not need to know that unity is being used in the application. Unity is a IOC container. Use it to make your app more loosely coupled.

The MEF (Managed Extensibility Framework) is the new concept in .net 4.0. It is used to create the lightweight and extensible applications to create Managed Extensibility Framework. It is not only allows the extension but also reused within the application.

MEF should be used for dynamic dependencies, it is great at dynamically loading components and with the use of attributes it make creating application extensions or an application that can be extended by others easy and streamlined.

14. Does MEF create singleton instance of objects by default?

Yes, MEF creates singleton instance by default.

15. What attribute should be added so that MEF does not create singleton instance?
Add below attribute to indicate that the created instance is not shared.

16. How to navigate to another page in WPF?

There is a class NavigationService which can be used for navigation of the WPF window:

this.NavigationService.GoForward();

OR

this.NavigationService.Navigate(“NextPage.xaml”)

17. How Prism combines individual units into a single unit?

PRISM uses dependency injection for the same.
Dependency Injection can be done by two way’s by using unity application block or MEF ( managed extensibility framework).

18. Does PRISM support MVVM?/Does PRISM do MVVM?

Although the prime focus of PRISM is modular development.
But PRISM does have ready made classes like delegate command which can help reduce MVVM code.
But please note that PRISM’s main goal of is not MVVM.

19. What are the different Navigations in PRISM?
In PRISM “Navigation” is defined as the process by which the application coordinates changes to its User Interface.
Prism provides the two styles of navigation:

  • State-Based Navigation : Accomplished by state changes to existing controls in the visual tree.
  • View-Based Navigation : Accomplished by the addition or removal of elements from the visual tree.

20. When to use State-Based navigation?
State-Based navigation is suitable in the following situations:

  • The view needs to display the same data or functionality in different styles or formats.
  • The view needs to change its layout or style based on the underlying state of the view model.
  • The view needs to initiate limited modal or non-modal interaction with the user within the context of the view.

Quick Reference :
learn more on Prism visit following links

Permanent link to this article: http://zappmania.in/2013/04/21/prism-interview-questions-and-answers.htm

2 comments

  1. Hi Seema,
    Please Give a simple example for clear understandable of page navigation in WPF Application.

    Regards,
    Rahul Kumar

    1. Hi Rahul, We have update the post and included a few links which can help you.
      Happy coding….
      🙂

Leave a Reply

Your email address will not be published.