If AddDbContext is used, then also ensure that your DbContext type
accepts a DbContextOptions object in its constructor and passes it to
the base constructor for DbContext.
The error message says your DbContext
(LogManagerContext
) needs a constructor which accepts a DbContextOptions
. But I couldn’t find such a constructor in your DbContext
. So adding the below constructor probably solves your problem.
public LogManagerContext(DbContextOptions options) : base(options)
{
}
Edit for comment
If you don’t register IHttpContextAccessor
explicitly, use below code:
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();