Skip to content

Commit ae44b98

Browse files
authored
Add more explicit guidance about views and sprocs (#754)
1 parent 9911e82 commit ae44b98

File tree

1 file changed

+10
-0
lines changed
  • docs/contributing/code-style

1 file changed

+10
-0
lines changed

docs/contributing/code-style/sql.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ We use the [Repository pattern][repository] with the MSSQL repositories being wr
1010
[Dapper][dapper]. Each repository method in turn calls a _Stored Procedure_, which primarily fetches
1111
data from _Views_.
1212

13+
1. **Views** define explicit column lists, selecting specific columns from tables
14+
2. **Stored Procedures** select `*` from views
15+
3. **C# objects** returned by repository methods match the columns defined in the corresponding view
16+
17+
This separation of concerns means:
18+
19+
- The view definition is where you specify which columns are needed
20+
- Stored procedures simply `SELECT * FROM [dbo].[ViewName]`
21+
- The view acts as a contract between the database and application layer
22+
1323
## Best practices
1424

1525
1. **Consistency**: Follow established patterns throughout the codebase

0 commit comments

Comments
 (0)