Git Product home page Git Product logo

referbruv / odataheroes Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 2.0 50 KB

ODataHeroes is a boilerplate solution, built to demonstrate OData API implementation in an ASP.NET Core (.NET 5) API

Home Page: https://referbruv.com/blog/posts/working-with-odata-integrating-an-existing-aspnet-core-3x-api

License: MIT License

C# 100.00%
template aspnetcore aspnetcorewebapi dotnetcore5 dotnet5 odata

odataheroes's Introduction

ODataHeroes - ASP.NET Core OData Boilerplate

ODataHeroes is a boilerplate solution, built to demonstrate OData API implementation in an ASP.NET Core (.NET 5) API

What is OData?

OData stands for Open Data. It is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs. It can help enhance an API to have extensive capabilities by itself, while we don't need to worry much about the data processing and response transformations as a whole and instead concentrate only on building the business logic for the API. OData adds one layer over the API treating the endpoint itself as a resource and adds the transformation capabilities via the URL.

One can integrate the prowess of OData into an ASP.NET Core API by installing the OData nuget available for .NET Core and get started.

Technologies

  1. ASP.NET Core (.NET 5)
  2. Entity Framework Core (EF Core 5)
  3. OData Library for ASP.NET Core (8.0.4)
  4. SQLite

About the Boilerplate

This boilerplate is a perfect starter for developers looking to implement OData. The solution offers the following:

  1. Onion Architecture with defined layers for API, Persistence, Contracts and Migrations
  2. Implemented code for UnitOfWork with Repository
  3. Seperated Controllers for API and OData
  4. Preconfigured Entity Framework Core migrations with SQLite
  5. Seeded data to view results as the solution starts

Getting Started

To get started, follow the below steps:

  1. Install .NET 5 SDK
  2. Clone the Solution into your Local Directory
  3. Navigate to the Cloned directory and run the solution

Testing the Solution

The solution contains necessary seeding code and uses SQLite database, so once the solution starts you'd already have data ready.

Once the solution is running, open a browser and try the below URLs to see OData in action.

To view the Metadata:

https://localhost:5001/odata/$metadata

Simple Get:

https://localhost:5001/odata/heroes

Get with OData Queries:

https://localhost:5001/odata/heroes?$filter=Id gt 100&$select=Id,Name&$skip=100&$top=100

Get Count:

https://localhost:5001/odata/heroes/$count

Get by Id:

https://localhost:5001/odata/heroes(1500)

The complete explanation of this sample is available at:

https://referbruv.com/blog/posts/working-with-odata-integrating-an-existing-aspnet-core-3x-api

Leave a Star if you find the solution useful. For more detailed articles and how-to guides, visit https://referbruv.com

Buy Me A Coffee

odataheroes's People

Contributors

referbruv avatar sriramkumarm1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hxmtl dbphoton

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.