百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

Restaurants

> 编程语言
开源

示例 .NET 8 API 项目,包含清洁架构原则、CQRS、Mediator 和 Entity Framework,并使用 xUnit 进行单元测试和集成测试

99 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

示例 .NET 8 API 项目,包含清洁架构原则、CQRS、Mediator 和 Entity Framework,并使用 xUnit 进行单元测试和集成测试

Restaurants API

This is a .NET 8.0 web API for managing restaurants, following the principles of Clean Architecture.

Video Course

This solution is part of a video course.

You can find the course at https://linktr.ee/fullstack_developer.

The course covers the development of this .NET 8.0 web API for managing restaurants, following the principles of Clean Architecture, in detail.

Project Structure

  • src/Restaurants.API: The main API project. This is the entry point of the application.
  • src/Restaurants.Application: Contains the application logic. This layer is responsible for the application's behavior and policies.
  • src/Restaurants.Domain: Contains enterprise logic and types. This is the core layer of the application.
  • src/Restaurants.Infrastructure: Contains infrastructure-related code such as database and file system interactions. This layer supports the higher layers.
  • tests/Restaurants.API.Tests: Contains unit tests for the API.

Packages and Libraries

This project uses several NuGet packages and libraries to achieve its functionality:

  • Serilog: This library is used for logging. It provides a flexible and easy-to-use logging API.

  • MediatR: This library is used to implement the Command Query Responsibility Segregation (CQRS) pattern. In this solution, commands (which change the state of the system) and queries (which read the state) are separated for clarity and ease of development.

  • Entity Framework: This is an open-source ORM framework for .NET. It enables developers to work with data using objects of domain-specific classes without focusing on the underlying database tables and columns where this data is stored.

  • Azure Storage Account: This service is used for handling blobs. Blobs, or Binary Large Objects, are a type of data that can hold large amounts of unstructured data such as text or binary data, including images, documents, streaming media, and archive data.

  • Microsoft Identity Package: This package is used for handling user identity in the web API. It provides features such as authentication, authorization, identity, and user access control.

Please refer to the official documentation of each package for more details and usage examples.

Getting Started

Prerequisites

  • .NET 8.0
  • Visual Studio 2022 or later

Building

To build the project, open the Restaurants.sln file in Visual Studio and build the solution.

Running

To run the project, set Restaurants.API as the startup project in Visual Studio and start the application.

API Endpoints

  1. GET /api/restaurants

    • Parameters: searchPhrase, pageSize, pageNumber, sortBy, sortDirection
    • Authorization Bearer token
  2. GET /api/restaurants/{id}

    • Parameters: id
    • Authorization: Bearer token
  3. GET /api/restaurants/{id}/dishes

    • Parameters: id
    • Authorization: Bearer token
  4. DELETE /api/restaurants/{id}/dishes

    • Parameters: id
  5. GET /api/restaurants/{id}/dishes/{dishId}

    • Parameters: id, dishId
  6. DELETE /api/restaurants/{id}

    • Parameters: id
    • Authorization: Bearer token
  7. POST /api/restaurants

    • Body: JSON object with properties Name, Description, Category, HasDelivery, ContactEmail, ContactNumber, City, Street
    • Authorization: Bearer token

Testing

The tests are located in the tests/* directory. You can run them using the test runner in Visual Studio.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言