views:

53

answers:

1

Why does T4MVC generate controller default constructor? Just curious.

+1  A: 

This thread has some discussion on this. In short, I had attempted to remove it, but it didn't' achieve that much so I didn't make the change. But for most people, this is a non-issue. Hopefully, that is the case for you as well, since you say you're 'just curious' :)

As for why it needs a default ctor, it has to do with the way T4MVC generates derived controller classes that it needs to be able to instantiate. For this to work, it needs to be able to properly construct the base class, which is not easy when it doesn't have a default ctor.

David Ebbo
But what did motivate you to implement this feature initially?
Idsa
Extended answer to give some details on this.
David Ebbo
Thank you! Now it's clear :)
Idsa