t4mvc : Cannot inherit a controller class which has no default constructor?

后端 未结 3 1319
独厮守ぢ
独厮守ぢ 2021-01-17 18:23

I am using T4MVC with MVC2.

I have the following building blocks:

  1. A simple entity interface which defines that every POCO entity must have a l

3条回答
  •  执念已碎
    2021-01-17 19:04

    I've noticed something very odd:

    I've added the empty constructor to the base class, but without the throw new NotImplementedException(); and it works fine.

    But here's the odd thing, when calling the controller if I have an url like /{controller}?params (default action being set to Index in the RouteConfig) the parameterless private controller on the base class is called. But when I have an url like /{controller}/{action}?params then the constructor with parameters is called.

提交回复
热议问题