ASP.NET Core web project architecture (step by step guide) - Part 1 - Separation of the database entities
Our templates provides you similar (to what you will see) project architecture, but this article is intended to familiarize you with the details and steps of their implementation.
1. Create the new type of web application ASP.NET Core web applicationI will call the project - ArchitectureExample
Then you would be prompt with another window in which you should select - Web Application (Model-View-Controller) and change the authentication to Individual User Accounts.
So far there isn't something special. You should now have the default MVC project architecture, which looks like that.
- Coupling of the web application and the database
- Coupling of the web application and the business logic
- Coupling in general of everything which could be put in a separate and independent project
2.Create real and solution folder called DataVisual Studio has a structural entity called solution folder, which shows a folder in the solution explorer, but it doesn't really create physical folder on the disk.
This is why you should create it manyally from the file explorer
Finally you should end up with this:
3.Move the data contentWhen you have the new project created you can now move the content of the Data folder from the web application to the new ArchitectureExample.Data project. Simple cut and paste will do the job.
4.Add reference to the new projectThe first step we can do is to make a reference between our Class Library and the Web Project. If you have fallowed the naming conventions which I set up, this should fix some of the errors, but of cource not all of them.
5. Install Entity Framework packageThe current implementation of the database expect that you should have Entity Framework package installed, which currently we don't have in our Class Library project. So lets install it. This package installs a lot of different related packages, but this is normal.
Another package which should be installed is the EntityFramework SqlServer.
In the part 2 we will discuss how create the Separation between the Web project, Business logic, Tests and Tools.