ASP.NET Core: A powerful API Design with OData, EF and SQLKata

API Design


Let’s first speak about what we know about the performance of an API design. Assume that we have entities over 1M+ rows in a database system. You can’t show that much data directly with an UI, you have the split into pages. In other words, we can say pagination. I may apply a “skip and take” methodology and show paged data.


REST & Entity Framework & OData can handle these actions painlessly.


The whole scenario is based on an entity on a database system which means it is can be a table, a document, etc. However, you may want to use OData features with a projection. In other words, you have a View on SQL that joins multiple tables and collects bunch of data.

You might say, each entity should be separate and live apart. In this case, you might think like your database system is old, big and growth uncontrolled. Thus, SQL View could help with your needs.

Therefore, CRUD operations couldn’t work and you have to handle the operations manually with respect to the columns.


Assume that, you have a song database. It has a restriction system for countries. And, you want to design a webpage that allows you to control the songs status over the countries with a checkbox.


The patch method provides a Delta<T> object which stores the changes. We can handle the request;


UPDATE [Country_Songs] SET [Status] = @p0 WHERE [SongId] = @p1


OData presents powerful features depending on your needs. The standard procedure is not always available for you and you have to improvise for each case. As a result, you have a powerful, fast and RESTful API concept.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store