This applies to any shared, external resource, such as a database connection. It's a low level principle that most modern developers don't even think about, but I think it's still worth mentioning.
This assumes data access is not local to the application, which is typical for most web apps. A native app with an integrated data store might not need to follow this.
Avoid getting more data than you need. This applies both to number of rows and number of columns (if thinking in tabular terms). Overfetching leads to performance issues at every level of the stack.
Such data is frequently referred to as "read-mostly". Basically, avoid constantly asking your database for the exact same data, especially if you're doing it multiple times per second.
The DRY principle applies to data access code. Most of the patterns and abstractions we use for data access are meant to reduce the amount of repetitive plumbing code we write, so we can focus on higher level concerns (and make fewer mistakes).
This often only becomes important with the need to scale or other requirements, but considering it from the start can make such changes easier.
Single Responsibility
Open/Closed
Interface Segregation
Dependency Inversion
I don't have a great example of Liskov Substitution mattering to much in the context of data access or I'd just say all of SOLID...
ndcmelbourne.com/agenda?day=29-…
🎶"So what'd I miss?"🎵
What fundamental principle(s) of data access would you include that I haven't covered in the above thread?
#programming #dotnet #csharp
ardalis.com/data-access-pr…