From 71941de346490ab2080a59beed43d4831027656a Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Wed, 21 Jan 2026 08:55:46 +1000 Subject: [PATCH 1/2] Add more explicit guidance about views and sprocs --- docs/contributing/code-style/sql.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/contributing/code-style/sql.md b/docs/contributing/code-style/sql.md index 0e3635f16..dfbfc54a7 100644 --- a/docs/contributing/code-style/sql.md +++ b/docs/contributing/code-style/sql.md @@ -10,6 +10,16 @@ We use the [Repository pattern][repository] with the MSSQL repositories being wr [Dapper][dapper]. Each repository method in turn calls a _Stored Procedure_, which primarily fetches data from _Views_. +1. **Views** define explicit column lists, selecting specific columns from tables +2. **Stored Procedures** select `*` from views +3. **C# objects** returned by repository methods match the columns defined in the corresponding view + +This separation of concerns means: + +- The view definition is where you specify which columns are needed +- Stored procedures simply `SELECT * FROM [dbo].[ViewName]` +- The view acts as a contract between the database and application layer + ## Best practices 1. **Consistency**: Follow established patterns throughout the codebase From a5ff733e540775194273d1fb1554e87174a68160 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Wed, 21 Jan 2026 09:37:32 +1000 Subject: [PATCH 2/2] claude review