An open API service indexing awesome lists of open source software.

https://github.com/timothyjan/todoapi-asp.netcorewebapi

TodoApi using the ASP.NET Core Web API.
https://github.com/timothyjan/todoapi-asp.netcorewebapi

Last synced: about 1 year ago
JSON representation

TodoApi using the ASP.NET Core Web API.

Awesome Lists containing this project

README

          

# TodoApi-ASP.NetCoreWebAPI
TodoApi using the ASP.NET Core Web API. Controller-based web API that uses a database. Tutorial link


Design
design-screenshot


Swagger Documentation

link

Notes:


  • A model is a set of classes that represent the data that the app manages. The model for this app is the TodoItem class.

  • The database context is the main class that coordinates Entity Framework functionality for a data model. In ASP.NET Core, services such as the DB context must be registered with the dependency injection (DI) container. The container provides the service to controllers.

  • Add new Scaffolded Item in the Controllers folder to generate code.

  • The return type of ActionResult<T> type. ASP.NET Core automatically serializes the object to JSON and writes the JSON into the body of the response message.

Prevent over-posting:


  • Production apps typically limit the data that's input and returned using a subset of the model.

  • There are multiple reasons behind this, and security is a major one.

  • The subset of a model is usually referred to as a Data Transfer Object (DTO), input model, or view model.

  • A DTO may be used to:

    • Prevent over-posting.

    • Hide properties that clients are not supposed to view.

    • Omit some properties in order to reduce payload size.

    • Flatten object graphs that contain nested objects. Flattened object graphs can be more convenient for clients.