This library provides many built-in ASP.NET Core Web API routes for simplified and DRY REST Apis!
Simpliest scenarios:
Demo app built on the library: http://genericcrud-demo.lonesomegeek.com. Here is the Documentation.
This library is used to provide simplified RESTful CRUD apis with a multilayer architecture:
- Generic CRUD Controller layer
- Generic CRUD Service layer
- Generic CRUD Repository layer
- -== NEW ==- More information on how to customize each layers
This library allies injection (IoC), minimum codebase for maximum efficiency.
Obviously, when you are working with databases and entities, you need to write some code to be able to manage these entities. And, when working with multiple kind of entities, you need to rewrite code that is similar for each entities. This library is getting rid of the duplicated code and keeps everything DRY. Here is what the library is able to do!
Verb | Route | Results | Description | |
---|---|---|---|---|
C | GET | /[entity] | 200 | Retreive all objects |
C | GET | /[entity]/:id | 200,404 | Retreive one object |
C | HEAD | /[entity]/:id | 204,404 | Get an indication of the existance of an object |
C | POST | /[entity] | 201,400 | Create an object |
C | PUT | /[entity]/:id | 204 | Update an object |
C | DELETE | /[entity]/:id | 200,404 | Delete an object |
C | POST | /[entity]/:id/copy | 201,404 | Copy active version of an object in a new object |
HC | GET | /[entity]/:id/history | 200,404 | Get transaction history of an object |
HC | POST | /[entity]/:id/restore | 201,404 | Restore a deleted object in a new object |
HC | POST | /[entity]/:entityId/restore/:changesetId | 201,404 | Restore a version of an object in the same object |
HC | POST | /[entity]/:entityId/copy/:changesetId | 201,404 | Copy a version of an object in to a new object |
HC | GET | /[entity]/read-status | 200 | Retreive all object with their read status |
HC | GET | /[entity]/:id/read-status | 200 | Retreive one object with its read status |
HC | POST | /[entity]/read | 201 | Mark all objects as "read" |
HC | POST | /[entity]/:id/read | 201,404 | Mark one object as "read" |
HC | POST | /[entity]/unread | 201 | Mark all object as "unread" |
HC | POST | /[entity]/:id/unread | 201,404 | Mark one object as "unread" |
HC | POST | /[entity]/:id/delta | 201,404 | Extract change delta of one object |
Legend
Code | Description |
---|---|
C | Feature available in CrudController |
HC | Feature available in HistoricalCrudController |
--Enjoy! |
You need:
- .NET Core 3.1 SDK (for any of the options below)
You also need one of these options below:
- Visual Studio (Visual Studio 2019 - v16.4+)
- Visual Studio Code
- Notepad ;)
This library has been designed to be pretty extensible. Here is some features supported and links to further documentation:
- LSG.GenericCrud
- Untyped entity key: More details
- Entity history tracking: More details
- Copy of an existing object into another one
- Readeable CRUD, to let you know personaly (as a user) if something has changed since last view
- Data fillers: More details
- Layer customization: More details
- LSG.GenericCrud.Dto
- DTO to Entity (and Entity to DTO) mapping for Crud<T> or HistoricalCrud<T> controllers: More details