A small .NET console app that models a training company's data with Entity Framework Core and SQLite. It shows how to define entities, set up a DbContext, create the schema with EF migrations and query the data.
On startup the app connects to a local SQLite database and prints:
- every training category (code and name)
- every trainer (ID and name)
| Entity | Fields | Relationships |
|---|---|---|
Category |
CategoryCode, CategoryName |
many-to-many with Trainer |
Trainer |
TrainerId, Name, Location |
many categories, many sessions |
TrainerCategory |
TrainerId, CategoryCode |
join table for trainers ↔ categories |
Session |
SessionId, TrainerId, SessionDate, BookingReference (optional) |
belongs to a trainer |
The schema and sample data (categories, trainers and their sessions) are seeded with HasData and created by the EF Core migration in Vista.app/Data/Migrations. The database file, vista.trainers.db, is stored in your Documents folder.
C# · .NET 8 · Entity Framework Core 8 · SQLite
Requirements: .NET 8 SDK or newer
git clone https://github.com/fahad16jpeg/Base.App.NET.git
cd Base.App.NET
# Create the database from the migrations (one-time)
dotnet tool install --global dotnet-ef
dotnet ef database update --project Vista.app
# Run the app
dotnet run --project Vista.appBase.App.NET/
├── Vista.slnx
└── Vista.app/
├── Program.cs # Lists categories and trainers
├── Vista.app.csproj
└── Data/
├── TrainersDbContext.cs # DbContext + SQLite configuration
├── Category.cs
├── Trainer.cs
├── TrainerCategory.cs
├── Session.cs
└── Migrations/ # EF Core migrations
Muhammad Fahad · @fahad16jpeg