I wanted the controller base class to be abstract, and the constructor to be protected and parameterized. Get this problem by adding an empty constructor to the ControllerBase that throws a NotImplementedException.
Not quite right, but he is doing his job. The only problem is that, in conjunction with dependency injection, the wrong constructor will be called - since it throws an exception, the application will crash.
the code:
public abstract class ControllerBase : Controller { protected object AlwaysSupply { get; private set; } public ControllerBase() { throw new NotImplementedException(); } public ControllerBase(object alwaysSupply) { AlwaysSupply = alwaysSupply; } }
This will cause T4MVC to create compiled code. It seems that the error is always trying to generate an empty constructor (without parameters) for controller classes.
Hope this helps someone.
Ales potocnik hahonina
source share