This project is read-only.

Question on virtual methods

Jun 21, 2013 at 11:22 AM
Hi there

I have a question for the creators of the T4 script with regards to the fact that it creates virtual keywords in my classes when I've added the T4MVC script in my project.


I went through the code and all I see is a generation of another class that inherits my controller(s) and overrides their methods to give me the capability in my .cshtml or .aspx files to reference my controller and action names.

I'm curios why this approach was taken. Why not just create another controller class (since you are making use of a code generator) with a slightly different name with the same actions, etc. for this purpose? Then my code doesn't have to be affected.

Its just that I don't want my code to change because of a script that is only supposed to reflect on my controllers.
Please let me know what benefit it gives me as the user. I tried going through the docs but I can't find anything that explains this motive.


Jun 21, 2013 at 4:14 PM
See this post. In short, it makes refactoring an 'Go to definition' work.