Skip to content

Sample .Net8 API implementation using the Mediator Design Pattern

Notifications You must be signed in to change notification settings

salihigde/mediatr-sample-api

Repository files navigation

Sample .NET 8 API Implementation using the Mediator Design Pattern

This project provides a fully functional example of a .NET 8 API built with the Mediator Design Pattern. It demonstrates best practices for handling exceptions, validating requests, and logging through middleware, filters, and behaviors.

Key Features

Swagger Integration

Swagger

Getting Started

Prerequisites

  • .NET 8 SDK
  • SQLite (no additional setup needed, SQLite is file-based)

Running the Application

  1. Build the project:

    dotnet build
  2. Start the application:

  • Option 1: Use debug mode in your IDE.

  • Option 2: Run the application from the /src folder:

    dotnet run
  1. Apply Database Migrations (if needed): To ensure the SQLite database is up-to-date, apply any pending migrations:

    dotnet ef database update

Running Unit Tests

  • Run the following command in MediatrSampleApi.UnitTest folder:

    dotnet test

Built With

Development

Testing

  • FluentAssertions - Fluent API for asserting the results of unit tests that targets
  • MyTested - Fluent testing library for ASP.NET Core MVC
  • AutoFixture - Auto-generates test data.
  • Moq - Mocking library for .NET.

About

Sample .Net8 API implementation using the Mediator Design Pattern

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages