Skip to content

This library is used to provide simplified RESTful CRUD apis with: Untyped Crud Controller Untyped Repository. This library allies injection (IoC), minimum codebase for maximum efficiency.

License

lonesomegeek/LSG.GenericCrud

Repository files navigation

LSG.GenericCrud

NuGet NuGet Board Status GitHub license

TL;DR - Getting started / Tutorials

This library provides many built-in ASP.NET Core Web API routes for simplified and DRY REST Apis!

Simpliest scenarios:

  • Using Visual Studio Code (or command line): Tutorial
  • Using Visual Studio (2019 v16.4+): Tutorial

Demo app built on the library: http://genericcrud-demo.lonesomegeek.com. Here is the Documentation.

Introduction

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!

Prerequisites

You need:

You also need one of these options below:

Features supported, by library

This library has been designed to be pretty extensible. Here is some features supported and links to further documentation:

Release notes

Breaking changes