Skip to main content

Posts

Showing posts with the label OData

A Small Demo On OData(v8) In .NET 7 API Application

In this article, we are going to implement a sample on OData in .NET7 API application. OData: The OData(Open Data Protocol) is an application-level protocol for interacting with data via the restful interface. OData supports the description of data models, editing, and querying of data according to those models. OData query features are: $select $orderBy $filter $skip $count $expand Sample SQL Table Scripts: Let's run the below sample SQL script to create a table like 'Employee'. Sample SQL Script: Create Table Employee( Id INT IDENTITY(1,1) NOT NULL, FirstName VARCHAR(200) NULL, LastName VARCHAR(200) NULL, Salary Decimal(18,2) NULL, JobRole VARCHAR(50) NULL CONSTRAINT PK_Employee PRIMARY KEY (Id) ) Create .NET7 Web API Application: Let's create the .NET 7 Web API application to accomplish our demo. Here to create .NET 7 application we use IDE's(editors) either Visual Studio 2022 or Visual Studio Code(Using .NET CLI command). In this demo, we are going to use

Introduction On OData(Version 8) In .Net5 Web API Application

In this article, we are going to understand the steps to integrate OData(Version 8.0) into our .Net5 application. OData: The OData(Open Data Protocol) is an application-level protocol for interacting with data via a RESTful interface. OData supports the description of data models, editing, and querying of data according to those models. OData's main advantage is users can query the API results. So OData query or filter can be done in two different approaches: Approach - 1: A response collection from an action method can be filtered by the OData. Means if action method fetched the collection of records from the database and returning to user, in the middle OData will filter the response data based on user query. Approach - 2: Action method that returns an entity framework query of type 'IQueryable', then OData generates a SQL query based on the user OData query request, then executes against the database and then returns the result to the users. OData query features are: $se