Microsoft Visual Studio 2019 solution for teaching working with SQL-Server databases. Rather than place all code in the front-end project or split code between front-end/back-end, code has been broken out to smaller class projects which allows code to be used in other projects.
🛑 Important
- Before working with this code, create and populate the database via this script using SSMS (SQL-Server Managment Studio)
- Ensure .NET5 is installed, if not install from here.
- Since Microsoft updates the .NET Core Framework at least once a year there is a chance changes may affect this code from running as intended with a later framework thus no guarantees this code will work as when the code was written. This goes for any code samples found on the web.
- From Solution Explorer, right click the top node, right click, select rebuild
- If the build fails, open the Visual Studio
Output window
from Visual Studio menu View, Output window see what the error is. Most of the time it will be apprarent e.g. missing an NuGet package (if some run NuGet Restore packages by right clicking on the top node of solution explorerRestore NuGet packages
followed by building the solution again.)
- If the build fails, open the Visual Studio
- Run BasicReadEntityFrameworkCore project and/orBasicRead project.
Project | ◻️ | Purpose |
---|---|---|
ConfigurationHelper | test | |
BasicRead | 🟡 | Utilizes SqlOperations to read data into a DataGridView |
BasicReadEntityFrameworkCore | 🟣 | Utilizes SqlOperationsEntityFrameworkCore to read data into a DataGridView |
SqlOperations | 🟡 | Provides code to interact with SQL-Server using SqlClient data provider |
SqlOperationsEntityFrameworkCore | 🟣 | Provides code to interact with SQL-Server using Entity Framework Core |
EntityCoreExtensions | 🟣 | Various language extensions for a DbContext |
DataGridViewHelpers | - | Language extensions for DataGridView control |
DataTableHelpers | - | Language extensions for DataTable class |
StopWatchLibrary | - | Contains class to record elapsed time using a StopWatch component |
WinFormHelpers | - | Classes for working with Window forms projects (non-visual) |
WinFormDialogs | - | Wrapper class for common dialog(s) |
CommonLanguageExensions | - | String extension methods |
EntityFrameworkCoreProductTest | ⚪ | Unit tests for validating EF Core operations on product model from SqlOperationsEntityFrameworkCore |
SqlClientTest | ⚪ | Unit tests for validating SqlClient data provider operations |
LanguageExtensionTest | ⚪ | Validates extension methods in CommonLanguageExtensions project |
ValidationLibrary | Data annotation validation library | |
ValidationWithAnnotationTest | ⚪ | Validates ValidationLibrary |
BaseExceptionsLibrary | - | Exception helper |
QueryContainerLibrary | 🔵 | query storage |
🟣 Entity Framework Core
🟡 SQL client data provider
⚪ Unit test
🔵 VB.NET code
✔️ Modified NorthWind database
✔️ Connections are obtained from appsetting.json
- Solution folders are used for partitioning functionality, classes, frontend and test project for instance for organization purposes. Solution folders do not physically exist on disk.
- Delegates/evemts are used, if never used before see Microsoft documentation.
👉 ef-core-find-csharp repository using Visual Studio 2017