đź’ˇIt is Microsoft's recommended way, but be careful. It might become nightmare.
Microsoft’s official guidance recommends registering your DbContext with a scoped lifetime in ASP.NET Core. On the surface, this makes sense: a single DbContext instance is tied to the lifetime of an HTTP request, but