With c# code, the folder structure does not matter. Only the namespace and object names. While it’s common for the namespace to match the folder structure, it’s not a requirement. Most likely your dbcontext namespace does not match. As for the best place, for a dbcontext, would be its own project.
Authentication - Context and Layout Location Best Practices / Targeting Context

Dean Everhart
1,541
Reputation points
Two Questions:
1. I want to resolve the error below
2. I mirrored the Views.Shared._Layout.cshtml and Data....Context.cs hierarchy within the Areas.Identity folder (see: Solution Explorer below) ...the thought being to keep Authentication concerns separate from the project. This maynot (probably is not) the best way to go about this; should I / how should I organize this differently?
Question: What is the best practice for location of the layout and context items for a project?
GitHub: Authentication Tutorial: Introduction to Identity on ASP.NET Core / Migrations My Notes: Authentication Environment: Net Core 6, Visual Studio Community 2022 (64 bit), WIndows 11
Error:
Solution Explorer:
Thank you.
Developer technologies ASP.NET ASP.NET Core
4,815 questions
Developer technologies ASP.NET Other
3,597 questions
Accepted answer
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2023-04-14T15:11:19.75+00:00