I'm newbie in ASP .NET Core and need little help. I have created ASP .NET Core 2.0 MVC project with individual authentication. Now I want to access Current ApplicationDbContext in my AccountController. By searching i found that we can use Dependency Injection like this code.
private readonly ApplicationDbContext _context; public AccountController(ApplicationDbContext context) { _context = context; } This method works good in all other controllers except Scaffolded AccountController and the following error is generated on running project:
InvalidOperationException: Multiple constructors accepting all given argument types have been found in type 'PacePreneur.Controllers.AccountController'. There should only be one applicable constructor. I know this error is due to this new constructor as AccounntController already has a constructor but i don't know how to use that for getting current DbContext. I'm still searching for a other solutions.
PS: Sorry if it's a non-sense question.