An awesome guide on how to build RESTful APIs with ASP.NET Core

An awesome guide on how to build RESTful APIs with ASP.NET Core
0

by Evandro Gomes

RESTful is not a new term. It refers to an architectural style where web services receive and send data from and to client apps. The goal of these applications is to centralize data that different client apps will use.


This is a companion discussion topic for the original entry at https://www.freecodecamp.org/news/an-awesome-guide-on-how-to-build-restful-apis-with-asp-net-core-87b818123e28/

Just a question, why isnt AppDbContext declared under the namespace Supermarket.API.Persistence.Context but instead its under Supermarket.API.Domain.Persistence.Context? Almost all others seem to follow folder structure as their namespace

Sorry I don’t mean to sound horrible but this is a post of how not to do things, there are good examples here of anti-patterns and usual beginner pitfalls. It’s fine though we all have to start somewhere, and there is always more to learn.

  1. You are abstracting abstractions for no reason, DI and the ORM are already an abstractions

  2. AutoMapper is generally a anti-pattern for anything more than boring left-hand-side right-hand-side code called out by it’s creator https://stackoverflow.com/a/28585993/324497 If in doubt don’t use.

  3. The repository pattern is considered an anti-pattern by anyone that matters, consider replacing with the Command Pattern https://github.com/jbogard/MediatR

Consider reading these articles and adjusting your post.
https://lostechies.com/jimmybogard/2012/09/20/limiting-your-abstractions/




https://lostechies.com/derekgreer/2018/02/20/ditch-the-repository-pattern-already/