Scaffolding controller in Rider

北慕城南 提交于 2020-01-05 04:26:24

问题


I'm trying to move from VS 2017 into Rider... the IDE is very appealing!

WITHOUT using the command line, is there a way to scaffold a controller in the fashionable way of adding a controller from the context menu, as in here:


回答1:


No, you do not have the options to scaffold a controller from a class or viewmodel as in VisualStudio, but you still can create a controller with a right click.

Althought it is not as fashionable as VisualStudio, you can add a Controller in a very similar way:

  1. Right click in the Controller folder.
  2. In the context menu select New->Controller.

Rider will create a simple Controller structure for you like this:

using System.Web.Mvc;

namespace ASPNETMVCApplication.Areas.Admin.Controllers
{
    public class Controller1 : Controller
    {
        // GET
        public ActionResult Index()
        {
            return
            View();
        }
    }
}

Then you can Alt+Enter over the View() and create a view.

But it is still far away from the options VisualStudio offers in this situation.

Rider version: Rider 2017.1.1 Build #RD-171.4456.2813, built on August 22, 2017



来源:https://stackoverflow.com/questions/46062951/scaffolding-controller-in-rider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!