开发者

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

开发者 https://www.devze.com 2023-03-06 20:29 出处:网络
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?

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号