Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Is it possible to replace the IUnityContainer with an own custom IUnityContainer?

$
0
0
Hello,

I already know how to replace the "build-in" region manager (or other framework classes) with a custom region manager in Prism 5.0 framework.

But is it also possible to replace the "build-in" Unity container with a custom Unity container?

I already have overwritten the CreateContainer() method in the bootstrapper like this:
    protected override Microsoft.Practices.Unity.IUnityContainer CreateContainer()
    {
             return new MyNamespace.Prism.UnityContainer();
     } 
But the issue is, that I cannot use my own container when creating modules and so on.

For example this fails:

```
         public LoginModule(MyNamespace.Prism.IUnityContainer container, IRegionManager regionManager)
 {
     _container = container;
     _regionManager = regionManager;
 }

My question is: What do I need to tell the bootstrapper or the module catalogue, that they use my custom implementation of a IUnityContainer?

The background for this question is, that I want to register my classes with enums, instead of strings or class types- I want to iterate over all my module enums in my unit tests, without always having to extend my unit tests with new module classes or strings.

I guess this case is just a "one-liner", like with the region manager, but I just can't figure out, where to it.

Thank you.

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>