This library is used to provide simplified RESTful CRUD apis with a multilayer architecture:
- Generic Crud Controller
- Generic Entity Framework Repository.
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 are forced to rewrite code that is similar for each entities. This library is getting rid of the duplicated code and keeps everything DRY.
Enjoy!
You need:
- .NET Core 2.0 SDK (for any of the options below)
You also need one of these options below:
- Visual Studio, at least a version that supports aspnetcore (Visual Studio 2015 Update 3+)
- Visual Studio Code
- A command line and some will-power =P
CRUD stands for Create, Read, Update, Delete
See wikipedia definition.
CRUD is not everything. You can do CRUD in many ways. But, in these days, we (as developers) are more in the JSON and in the REST things... This is what this library is for! Doing RESTful CRUD operations in a simplified way!
Here is a sample of RESTful CRUD URLs for an entity of type Account:
VERB | URL | Description |
---|---|---|
GET | /api/accounts | Retreive all accounts |
GET | /api/accounts/:id | Retreive one account |
POST | /api/accounts | Create one account |
PUT | /api/accounts/:id | Update one account |
DELETE | /api/accounts/:id | Delete one account |
I've designed this library to be pretty extensible. Here is some features supported and links to further documentation:
- Support for entity history tracking: More details
- Automatic DTO to Entity (and Entity to DTO) mapping for Crud<T> or HistoricalCrud<T> controllers, provided by LSG.GenericCrud.Dto: More details
- Automatic data fillers: More details
- Full async pipeline: More details
- Support for custom repository logic: more details to come
Actually unsupported features (feel free to help if you want!):
- Per entity security policies
- and more...
I am presenting here really simple scenarios, more complex will come:
- RESTFul CRUD API for Account Entity
Want to have a look to more samples, take a look at these samples: Link
If you already know what to do to get up'n'running with this library, use one of these commands to install my NugetPackage:
If using dotnet cli in an existing project
dotnet add package LSG.GenericCrud
If using Package Manager Console (in Visual Studio)
Install-Package LSG.GenericCrud
If you need other features that are not in the base library, you can install these libraries:
- Dto/Entity mapping support: LSG.GenericCrud.Dto
- Data Fillers and middlewares: LSG.GenericCrud.Extensions
Note: There is actually missing documentation on what is included in these libraries. More documentation will come!