A while ago somebody asked for guidance on which database technology to use for a new application. Even though our part of the organization uses mostly Microsoft technology, there still is a lot to choose from. In the .NET space Microsoft currently offers five distinct ways to access a database:
- ADO.NET Core
- ADO.NET Entity Framework
- ADO.NET Data Services
- ADO.NET Sync Services
So how do you choose?
An architect typically defines (or borrows) principles and lets them guide him. So lets give that a try.
From the ivory tower…
In our global reference architecture there is a principle that can get us started:
Apply a technology only for its intended use!
The Application Architecture Guide can help us here as it defines various application archetypes and maps technologies to those archetypes. We can use these archetypes to classify the applications we build and maintain and then select (or reject) technologies based on those archetypes. As it turns out the applications we build mostly use these three archetypes:
- Web Application Archetype
- Service Application Archetype
- SharePoint LOB Application Archetype
That immediately eliminates ADO.NET Data Services and ADO.NET Sync Services since those technologies are primarily aimed at Rich Clients.
From the store…
Another principle that applies in this case is coming from our database administrators:
You must use stored procedures!
Since LINQ2SQL is not working well with stored procedures as well as its being superseded by ADO.NET Entity Framework. This means LINQ2SQL also has to go.
From the boss…
Now we’re left with ADO.NET Entity Framework and ADO.NET Core. Both are good technologies to use for data access so which do we prefer? That brings us to the final principle for this case:
Use as little custom code as possible!
This makes us favor ADO.NET Entity Framework but with one caveat. If there is a performance bottle neck in the data access layer which makes it impossible to meet the performance requirements then the development team can use ADO.NET Core together with the EntLib data access block to get that extra bit of performance.
All for you
When you have a lot to choose from and a hard time choosing, try borrowing or defining some guiding principles. These can help you reduce the problem and simplify the decision process and as long as you apply them consistently they will make your work a little bit easier.