2

Closed

My controllers do not have a default constructor. Error in file XXController.generated.cs

description

I install AutoT4MVC then T4MVC using nuget Install-Package T4MVC in my projet.

But an error occurs in all generated classes for my controllers

Sample error:

Error 9 'BindSolution.Framework.Web.Controllers.BindEntityController<CreditoImobiliarioBB.Model.Agencia,CreditoImobiliarioBB.Web.ViewModels.AgenciaViewModel>' does not contain a constructor that takes 0 arguments I:\Clients\creditoimobiliariobb.com.br\src\CreditoImobiliarioBB\CreditoImobiliarioBB.Web\agenciasController.generated.cs 25 10 CreditoImobiliarioBB.Web
Closed Jan 28, 2015 at 3:12 PM by KevinKuszyk
As part of our move to GitHub, we are closing all the outstanding issues on CodePlex.

If your issue is still valid, please re-open it on GitHub:
https://github.com/T4MVC/T4MVC/issues

Thanks for contributing!

comments

davidebbo wrote Oct 9, 2012 at 11:32 PM

It might be something specific to your project. Can you try to isolate to a minimal repro you can share (e.g. on github)?

Ridermansb wrote Oct 10, 2012 at 2:25 AM

Any controller that does not have a default controller will have this problem.
See this: http://stackoverflow.com/questions/3723883/t4mvc-generates-controller-empty-constructor

davidebbo wrote Oct 10, 2012 at 3:37 AM

Ah yes, T4MVC indeed has this restriction. It's unclear whether there is an easy way to address it without drastically changing the way things work.

Ridermansb wrote Oct 10, 2012 at 12:05 PM

Yeah, I had to add a default constructor to T4MVC work.