As far as I know, the DBContext or underlying persistance technology should be only contained inside the Data layer.
Also, it feels very wrong to me to have identity package inside the user interface layer. The identity should be the responsibility of a centralized business layer, which in case should be usable by other parts of the application (e.g. wpf, forms, web-api projects etc), and not just asp.net front-end.
If I separate the identity to another layer, this partially solves the problem, but this time, I have to specify the DBContext inside the Startup.cs file for front-end, which should only reference Business Layer and work with View Models or DTO's.
The business layer should provide the authorization/authentication services, and attributes for decorating relative methods for permissions.
Anything with the name "ASP.NET" should be contained inside the user interface layer.
Also, the dependency injection framework should also be partially configurable across layers of the application, which should permit specifying required instances of specific classes inside that layer.
I'm extremely confused about the choice of architecture in .NET Core.
Please guide me to the right way of creating the right architecture.