Can I change the controller code generation pattern?

In Visual Studio, when you add a new controller to your MVC application, the macro creates a file with methods such as:

//
// GET: /Thing/Details/5

public ActionResult Details(int id)
{
    return View();
}

I want my methods to look like this:

/// <example>GET: /Thing/Details/XXX...</example>
public ActionResult Details(Guid id)
{
    return View(Repository.GetItem<Thing, Guid>(id, "Id"));
}

The main differences are the standard comment notation with two deleted lines, and I use unique identifiers, not integers for my identifiers. If possible, I would like the code to pass my model into a view, which should also be generated.

Is there a built-in mechanism that will allow me to control the used code template?

+3
source share
1 answer

, .

+2

Source: https://habr.com/ru/post/1715406/


All Articles