Scaffolding controller in Rider

2019-08-18 16:10发布

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:

enter image description here

1条回答
做自己的国王
2楼-- · 2019-08-18 16:51

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

查看更多
登录 后发表回答