Skip to content

Chapter 7: Drivers & Data Access


Regarding Robert C. Martin, technical subsystems like storage, user-interface, external systems etc. are an implementation detail what should not bleed into your application logic. Put them behind a nice interface and implement them in the most outer ring: Framework & Drivers.

To do so my project has the Drivers solution folder. By the time of writing you find my implementations of database access (SQL with EF Core), image processing, email delivery and blob storage in here.

Each of these assemblies cover a topic by implementing their interfaces agains a concrete technology. If I like to use other technology to drive a topic in the future I simply replace these assemblies with the new implementations.


A few words on the data-access. I’ve implemented the SQL data-access using Entity Framework Core. I decided to not do another set of classes for the data-entities as they would be a 1:1 copy so far and I would need a ton of mapping code again.

Instead I put the mapping definitions of my entities into the data-access. I think Uncle Bob would not want this.

This may change when I go more into DDD style domain “aggregates” instead of relational entities. So far I did not have to need to change this.

I’m also thinking to move away from SQL to Azure Cosmos DB (MongoDB for local development). The main problem for this move is the ASP.Net Identity for which I used the standard EF Core implementation so far. I have to port this over from EF Core. Maybe Microsoft will provide a CosmosDB implementation one day.

The other issue with other database then SQL-Server is that for this project I have a very limited monthly budget and the SQL-Server is by way the cheapest option I found on Azure. $5/month while all other options I found where starting at $30/month.

One option I found which is extremely cheap (1-2 cents/GB/month). It first sound strange but Azure Storage. But if I move over to complete aggregates I could store them in JSON files/blobs. The only constrains would be complex queries but as I don’t have big-data this may be an option for persisting my data.

Let’s head over to my final thoughts and conclusions here …

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: