Unity container design time support

Mar 19, 2010 at 10:56 AM

Hi guys,

I am implementing a winform application following the MVP (PassiveView) pattern with an application (process flow) controller.

I have a view (user control) that instanciate its presenter that itself need to get its services dependencies injected.

It works well at run-time but at design time (let's say when I open the form containing the user control in design mode) my singleton unity accessor class call the ConfigurationManager.GetSection("unity") method with does return nothing....

Ok, afterall it seems normal because it is reading the devenv.exe.config file instead of my app.config file.

Does anybody have a solution to make it read the correct configuration file?

Or do i need to configure the container by code in this situation (which can be detected if current process is devenv.exe or ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath is ...devenv.exe.config)

Thanks for your help