I have a controller which takes a DbContext
and one who does not. I.e.,:
public CalendarController()
{
var db = new DbContext();
CalendarController(db); // <= Not allowed
}
public CalendarController(IDbContext db)
{
_calendarManager = new CalendarManager(db);
_userManager = new UserManager(db);
_farmingActionManager = new FarmingActionManager(db);
_cropManager = new CropManager(db);
}
Unfortunately the above gives an error on the CalendarController(db)
line:
Expression denotes a 'type', where a 'variable', 'value' or 'method group` was expected
Is it possible to call one constructor from another? I don't want to duplicate all the code.