The Microsoft Contoso University sample web app demonstrates how to create an ASP.NET Core Razor Pages app using Entity Framework (EF) Core. The project is based upon the tutorial on docs.microsoft.com. The projects that I will creating be refactored to reflect the clean architecture pattern using a pragmatic approach to software development. SOLID design principles and fundamental OOP will be used.
Thanks to folks like @ardalis, @EduardoPires, @garymcleanhall, & @jbogard for sharing lots of great patterns in their various GitHub repos & projects!
Use these instructions to get the project up and running.
You will need the following tools:
- Visual Studio Code or 2019
- .NET Core SDK 3.0
- SQL Server Management Studio
- SQL Server Developer Edition - Recommended because I'm a data honk who likes control over persistance :-)
- Clone or fork the project
- Open the master branch
- Create a new SQL Database (preferrably named ContosoUniversity).
- In the database_package folder, open ContosoUniversity_Database_Package.sql using your preferred .sql file editor.
- Update the DatabaseName in line 34 to the database name created in step 3 and close the file.
- Back in Windows Explorer, enter CMD in the address bar and press the Enter key which will open a command prompt window. If command prompt is blocked then enter POWERSHELL in the address bar and press the Enter key which will open a PowerShell window.
- Note: The path should be defaulted to the database_package folder.
- Paste the following code and press the enter key to deploy the databse code.
sqlcmd.exe -b -S "MICK" -o ".\contosouniversity.txt" -i ".\ContosoUniversity_Database_Package.sql"
- Back in Winodws Explorer, open the output file named contosouniversity.txt to verify that the database was created successfully.
- In Visual Studio, open the ContosoUniverity.sln, navigate to the ContosoUniversity.Web project, edit the appsettings.json file setting the proper database and server name.
A database diagram to help with understanding my take on this project is located here: ContosoUniversityDatabaseDiagram
- .NET Core 3.0
- ASP.NET Core 3.0
- Entity Framework Core 3.0
This project is licensed under the MIT License.