internal static void DoDefaultInjectionInController(object controller) { var controllerType = controller.GetType(); ///This will force a call to StartRequest WebMapLifeCycle.StartRequest(DefaultRequestProvider: WebMapMVCUtils.DefaultJsonProviderFromPOST); var viewManagerInstance = ViewManager.Instance; PropertyInfo logicProperty = controllerType.GetProperty("logic"); if (logicProperty != null) { object logic = IocContainerImplWithUnity.Current.Resolve(logicProperty.PropertyType, flags: IIocContainerFlags.NoView); logicProperty.SetValue(controller, logic, null); } var viewManagerProperty = controllerType.GetProperty("viewManager"); if (viewManagerProperty != null) { viewManagerProperty.SetValue(controller, viewManagerInstance, null); } else { viewManagerProperty = controllerType.GetProperty("ViewManager"); if (viewManagerProperty != null) { viewManagerProperty.SetValue(controller, viewManagerInstance, null); } } }
public static void SimulateStartOfRequest(string jsonRequest) { WebMapLifeCycle.StartRequest(jsonRequest); }