Esempio n. 1
0
        public static void Run1 <TContext, TRequest>(TContext context, NFinal.Action.ActionData <TContext, TRequest> actionData, TRequest request, NameValueCollection parameters)
        {
            using (Index controller = new Index())
            {
                Request request1 = null;
                IDictionary <string, object> context1 = null;
                //初始化

                controller.Initialization(context1, "Index", null, request1, CompressMode.None);
                ViewModel ViewBag = new ViewModel();
                ViewBag.a = 2;
                ViewBag.b = "3";

                ViewBag.c          = Index.c;
                ViewBag.c1         = Index.c1;
                controller.ViewBag = ViewBag;
                if (!controller.Before())
                {
                    return;
                }
                if (!Filter.FilterHelper.AuthorizationFilter(actionData.IAuthorizationFilters, controller))
                {
                    return;
                }
                if (!Filter.FilterHelper.BeforeActionFilter(actionData.IBeforeActionFilters, controller))
                {
                    return;
                }
                //添参数问题。。。
                //string a = request.parameters["a"];
                //int b = request.parameters["b"];
                //int? b1 = request.parameters["b1"];
                //ParameterModel c = new ParameterModel();
                //c = NFinal.Model.ModelHelper.GetModel(new ParameterModel(), request.parameters);
                controller.Index1(parameters["a"], parameters["b"], NFinal.Model.ModelHelper.GetModel <ParameterModel>(parameters));
                controller.After();
                if (!Filter.FilterHelper.AfterActionFilter(actionData.IAfterActionFilters, controller))
                {
                    return;
                }
                Filter.FilterHelper.AfterActionFilter(actionData.IAfterActionFilters, controller);
                if (!NFinal.Filter.FilterHelper.ResponseFilter(actionData.IResponseFilters, controller.response))
                {
                    return;
                }
                controller.Close();
            }
        }