Architecture
How the MyPortal solution is laid out, and how SQL is versioned and applied.
MyPortal is modular and API-first. The backend is an ASP.NET Core Web API, the frontend is a separate Angular application that talks to it over HTTP, and all schema changes are versioned in a dedicated migrations project.
Repository layout
| Project | Responsibility |
|---|---|
MyPortal.WebApi | ASP.NET Core host and HTTP endpoints |
MyPortal.Data | Repositories, Dapper queries, embedded SQL |
MyPortal.Migrations | Console runner that creates and updates the schema |
MyPortal.Core | Domain entities |
MyPortal.Contracts | Request and response DTOs |
MyPortal.Common | Shared interfaces and utilities |
MyPortal.Auth | Authentication and authorisation |
MyPortal.Services | Business logic between the API and the data layer |
MyPortal.Timetabler | Timetabling logic |
MyPortal.FileStorage | Document and attachment storage |
MyPortal.Frontend/myportal-spa | Angular SPA |
MyPortal.Tests | Backend tests |
Cross-cutting concerns
Permissions, auditing, and safeguarding controls are handled centrally rather than per-module. A module gets access control and an audit trail by being part of the system, not by reimplementing them.
The SPA serves staff, students, and parents from one application, with role-based routing deciding what each of them sees.
How SQL is managed
SQL lives in two places, and the distinction matters.
Schema changes — MyPortal.Migrations/Sql
Updates/— one-shot migrations, applied once each, in filename order.StoredProcedures/,Functions/,Views/,Indexes/— re-applied on every run, so they are written as idempotentCREATE OR ALTERstatements.
Runtime queries — MyPortal.Data/Sql
Query templates used by repositories at runtime.
Both directories are embedded resources. A new
.sqlfile must be registered as anEmbeddedResourcein the owning.csproj—MyPortal.Migrations.csprojorMyPortal.Data.csproj— or it will not be found at runtime.
Database support
SQL Server 2019 or newer is the supported database today. Additional providers are planned, but the embedded SQL is currently written against SQL Server.
Authentication
Authentication uses OAuth 2.0 and OpenID Connect, so identity can be delegated to a provider the school already runs rather than being managed inside MyPortal.