代码之家  ›  专栏  ›  技术社区  ›  T W

雷鸣圆顶行动召唤器asp.net mvc

  •  3
  • T W  · 技术社区  · 17 年前

      public ActionResult Index(Employee employee)
            {
                 //some actions here
                 return View(employeeViewModel);
            }
    

    动作调用程序应该是什么样子的?你能提供一些例子和单元测试吗?


    http://codebetter.com/blogs/jeremy.miller/archive/2008/10/23/our-opinions-on-the-asp-net-mvc-introducing-the-thunderdome-principle.aspx

    2 回复  |  直到 12 年前
        1
  •  1
  •   chadmyers    17 年前

    具体来说,OxiteActionInvoker: http://oxite.codeplex.com/SourceControl/changeset/view/31497#442766

    http://oxite.codeplex.com/SourceControl/changeset/view/31497#442745

    同样有趣的是,Oxite的人能够让你拥有IoC功能的动作过滤器(而不是必须在动作上指定所有过滤器——这可能违反OCP,因为动作必须知道它的所有可能使用方式)。您可以在OxiteActionInvoker方法“GetFilters”中看到这一点,它会点击FilterRegistry加载该操作的所有已注册过滤器。

        2
  •  0
  •   diadiora    17 年前

    link text

    jscportal\JSC.Portal.Web\Controllers\TemplatesController.cs 你会得到你想要的例子:

    public ActionResult List()
    {
        IList<Template> templates = Service.GetAll();
        return View(templates);
    }
    
    public ActionResult Edit(int id)
    {
        Template t = Service.GetById(id, false);
        return View(t);
    }