Skip to content

RESTful API built with ASP.NET Core 8, supporting both Entity Framework Core and Dapper for data access, with SQL Server as the database. Features .NET Aspire orchestration for telemetry capture, enabling performance benchmarking between EF Core and Dapper. Swagger is included for API endpoint documentation and testing.

License

Notifications You must be signed in to change notification settings

g-s-c-code/LibraryAPI

Repository files navigation

LibraryAPI

This repository contains a solution demonstrating two approaches for building a RESTful API: one using Entity Framework Core and the other using Dapper. Both projects are fully functional, interchangeable, and configured with Swagger for API documentation and testing. Each project functions independently, allowing users to select based on preference or requirements. Both projects also utilize .NET Aspire for orchestration and telemetry capture, enabling performance benchmarking between the two implementations.

Projects

1. Entity Framework Core Based API

This project demonstrates a RESTful API built with ASP.NET Core 8, Entity Framework Core and SQL Server. Swagger is utilized to document and test the API endpoints.

Architecture

  • Presentation: Interact with the API using Swagger UI.
  • Business Logic: Handles operations such as creating a book entry and managing loans.
  • Data Access: Uses Entity Framework Core for data management.

Features

  • CRUD Operations: Manage books, borrowers, and loans.
  • Data Validation: Ensures data integrity.
  • Swagger Documentation: Provides an easy way to understand and test API endpoints.

Notes

  • You will need to manually configure a database connection, as the database used during the build is not connected due to hosting costs.
Entity Framework Core

2. Dapper Based API

This project demonstrates a RESTful API built with ASP.NET Core 8, Dapper and SQL Server. It serves as a lightweight alternative to the EF Core-based API, providing a streamlined approach to data access.

Architecture

  • Presentation: Interact with the API using Swagger UI.
  • Business Logic: Similar operations as the EF Core-based API but implemented with Dapper.
  • Data Access: Uses Dapper for data management.

Features

  • CRUD Operations: Manage books, borrowers, and loans.
  • Data Validation: Ensures data integrity.
  • Swagger Documentation: Provides an easy way to understand and test API endpoints.

Notes

  • As with the EF Core-based API, you will need to manually configure a database connection due to the absence of a connected database.
Dapper

Usage

You can choose to run either project depending on your needs:

  1. Entity Framework Core Based API: Navigate to the LibraryAPI.EFCore project and set it as the startup project.
  2. Dapper Based API: Navigate to the LibraryAPI.Dapper project and set it as the startup project.

Both projects are fully configured to run standalone and include Swagger for API documentation and testing. Ensure you have the necessary database configurations set up in the appsettings.json file for the chosen project.

Getting Started

  1. Clone the repository:

    git clone https://github.com/g-s-c-code/LibraryAPI.git
  2. Navigate to the desired project directory:

    cd LibraryAPI/EFCore
    # or
    cd LibraryAPI/Dapper
  3. Install the required dependencies:

    dotnet restore
  4. Create and configure appsettings.json with your database connection (nested in 'root').

  5. Run the project:

    dotnet run
  6. Access Swagger UI at http://localhost:5000/swagger (port may vary).

About

RESTful API built with ASP.NET Core 8, supporting both Entity Framework Core and Dapper for data access, with SQL Server as the database. Features .NET Aspire orchestration for telemetry capture, enabling performance benchmarking between EF Core and Dapper. Swagger is included for API endpoint documentation and testing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages