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);
                }
            }
        }
        /// <summary>
        /// Simulates the end of request.
        /// That means persisting the StateCache
        /// and destroy the requesttimestorage
        /// </summary>
        public static void SimulateEndOfRequest()
        {
            var strWriter = new StringWriter();

            StateManager.GenerateAppChanges(strWriter, x => x);
            lastResult = strWriter.ToString();
            ViewManager.Instance.FulfillPromises();
            WebMapLifeCycle.EndRequest();
            ViewManager.Instance.FulfillPromises();
            if (StateManager.IsAvailable)
            {
                StateManager.Current.Persist();
            }
            WebMapLifeCycle.ClearInstanceVariables();
        }
Example #3
0
 public override void OnResultExecuting(ResultExecutingContext filterContext)
 {
     base.OnResultExecuting(filterContext);
     ViewManager.Instance.WaitForAsyncActions();
     WebMapLifeCycle.EndRequest();
 }
 public static void SimulateStartOfRequest(string jsonRequest)
 {
     WebMapLifeCycle.StartRequest(jsonRequest);
 }