Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么 T4MVC 会生成控制器默认构造函数?只是好奇。
该线程对此进行了一些讨论。简而言之,我曾试图删除它,但它并没有达到那么大的效果,所以我没有做出改变。但对于大多数人来说,这不是问题。希望你也是这样,因为你说你“只是好奇”:)
至于为什么它需要一个默认 ctor,它与 T4MVC 生成它需要能够实例化的派生控制器类的方式有关。为此,它需要能够正确构造基类,当它没有默认 ctor 时,这并不容易。