At the end of this tutorial, you will be using OData v4 in an ASP.NET CORE Web Application. OData provides a powerful and stable querying language that will help you to write less code and get more. To learn more about OData visit the official Homepage at https://odata.org. In the whole tutorial, I will be using the command line to create the project and add the needed dependencies. Through this procedure, everyone - and not only Windows users - can use this guide. However, for Windows users, there are equivalent ways provided by Visual Studio if you decide to do so. If you want to jump directly in the source code hop over to my GitHub Repository and clone it on your system.
Creating the Project
As the first step, we have to create a project which holds all the source code and logic for us. In this case, we are going for a dot net core webapi project.
After creating the project we can run it simply by typing in the following command.
As seen above the OData configuration is working perfectly fine. Now we have to change the Controller to act as a OData Controller and no longer as a API Controller. For this purpose I create a new Controller called CarsController.
Well, thats everything you have to do to get your data via the OData Standard. However, we also want to make use of the OData specific query functions like filter or search. For this we have to make a little extensions to the Startup.cs file.