简体   繁体   中英

How to access view generator parameters in ASP.NET MVC 3 T4 template?

I want to create custom template to generate view in ASP.NET MVC 3. Inside the template, I want to get the name of the selected controller. Where can I find it?

Actually there are several things I want to find out:

  • controller name: ...?
  • action name: ...
  • viewmodel name: Host.ViewDataTypeName
  • view name: Host.ViewName

Have you read Scott Hanselman's blog on changing the MVC default templates?

It's also worth taking a look at Where can I find the API specification for MvcTextTemplateHost?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM