ActionExecutionContext combined with ImportMany

Topics: Actions & Coroutines, Bootstrappers & IoC
Jul 28, 2011 at 10:51 AM

I try to use the Show class (OpenChildResult etc..)

public class Show
      public static OpenChildResult<TChild> Child<TChild>()
         return new OpenChildResult<TChild>();

      public static OpenChildResult<TChild> Child<TChild>( TChild child )
         return new OpenChildResult<TChild>( child );

In my Shell I do an lazy ImportMany on IModule interface, which is also a IConductor and should be my parent screen of the child screens, i.e. I do:

yield return Show.Child<SomeViewModel>().In<IMainModule>().Configured( c => c.ResultMessage = ".." );

The problem is that

IConductor parent = _locateParent( context );
in the OpenChildResult class points to the wrong view model/IMainModule. Is there a way to use Metadata to get the correct parent conductor?

Jul 28, 2011 at 12:48 PM

If you are calling Show.Child from within the parent, you should not use In<IMainModule>(). Try removing that to see if your problem is fixed.

Jul 28, 2011 at 8:41 PM

Since I am not calling Show.Child from within the parent conductor your solution is not working because my parent is only a screen.

Is it possible to execute Show.Child without .In<..>() on a Screen?

BTW, when I just use

yield return Show.Child<SomeViewModel>().In(Shell.ActiveMainModule)...
and everything is ok.