https://github.com/bjbr-dev/peregrinedb
CRUD Extensions for Dapper.Net
https://github.com/bjbr-dev/peregrinedb
dapper
Last synced: 5 months ago
JSON representation
CRUD Extensions for Dapper.Net
- Host: GitHub
- URL: https://github.com/bjbr-dev/peregrinedb
- Owner: bjbr-dev
- License: mit
- Created: 2016-12-29T19:51:35.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-24T06:19:18.000Z (about 5 years ago)
- Last Synced: 2025-08-16T01:15:32.737Z (7 months ago)
- Topics: dapper
- Language: C#
- Size: 926 KB
- Stars: 23
- Watchers: 2
- Forks: 4
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PeregrineDb - Lightweight CRUD Extensions for Dapper.Net
PeregrineDb is a small and fast [Dapper.Net](https://github.com/StackExchange/dapper-dot-net) extension library to perform CRUD statement with POCO models.
[](https://ci.appveyor.com/project/berkeleybross/peregrinedb/branch/master)
## Project aims
1. Provide fast and lightweight CRUD extensions for Dapper
2. Should be able to run against multiple different databases in the same project
3. Thread safety should be guarenteed
I was using the fantastic [Dapper.SimpleCRUD](https://github.com/ericdc1/Dapper.SimpleCRUD) library and found it incredibly easy to use. However, two things drove me to write this library - I have a project which uses SqlServer and Postgres databases side-by-side, and unfortunately Dapper.SimpleCRUD does not support this. Second, I found it was missing a few crucial optimizations which was doubling the time taken to easily insert many rows.
## DBMS Support
Currently, the following DBMS are supported. More will be added (e.g. SQLite) when there is demand for them:
- Microsoft SqlServer 2012 and above
- PostgreSQL
## Features
* Getting Started
* [Installing and using](https://github.com/berkeleybross/PeregrineDb/wiki)
* [Manual SQL methods](https://github.com/berkeleybross/PeregrineDb/wiki/Manual-SQL-Methods)
* CRUD Methods
* [Creating](https://github.com/berkeleybross/PeregrineDb/wiki/CRUD-Creating): Insert one or many entities, with or without generating a primary key.
* [Counting](https://github.com/berkeleybross/PeregrineDb/wiki/CRUD-Counting): Count how many entities match some conditions
* [Reading an Entity](https://github.com/berkeleybross/PeregrineDb/wiki/CRUD-Reading-One-Entity): Many overloads for searching for a single entity.
* [Reading many Entities](https://github.com/berkeleybross/PeregrineDb/wiki/CRUD-Reading-Many-Entities): Search for any number of entities matching arbitrary conditions. Includes pagination.
* [Updating](https://github.com/berkeleybross/PeregrineDb/wiki/CRUD-Updating): Update one or many entities, matched on primary key
* [Deleting](https://github.com/berkeleybross/PeregrineDb/wiki/CRUD-Deleting): Delete one, many or all entities
* [Testing your code](Test-helpers)
* DataWiper
* Contributing
Don't forget, for practical examples of usage, you can also browse our extensive [unit tests suite](tests/PeregrineDb.Tests).
## Comparison
*NB: These may not be correct nor up-to-date. I made this comparison very quickly*
| Library | Operations | Composite Keys | Async | .Net Core | Notes |
|---|---|---|---|---|---|
| [PeregrineDb](https://github.com/berkeleybross/PeregrineDb) | Count
Find/Get
Get(Range/All)
GetPage
Insert(Range)
Update(Range)
Delete(Range/All) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
- Can work across multiple DBMS in same project
- Throws exceptions for inconsistencies (E.g. Update not affected anything)
| [Dapper.Contrib](https://github.com/StackExchange/dapper-dot-net/tree/master/Dapper.Contrib) | Get
GetAll
Insert
Update
Delete(All)
| :heavy_check_mark: | :heavy_check_mark: | |
- Can use interfaces to track changes
| [Dapper.Extensions](https://github.com/tmsmith/Dapper-Extensions) | Get
Insert
Update
Delete
GetList
GetPage/GetSet
Count | :heavy_check_mark: | | |
- Can use simple lambdas and predicates
- Generates GUID keys
- Can be configured without attributes
| [Dapper.FastCRUD](https://github.com/MoonStorm/Dapper.FastCRUD/tree/master/Dapper.FastCrud.Tests) | Insert
Get
Find(Equivalent to GetRange)
(Bulk)Update
(Bulk)Delete
Count | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
- Has a nice fluent syntax for complex WHERE operations
- Can be configured without attributes
| [Dapper.SimpleCRUD](https://github.com/ericdc1/Dapper.SimpleCRUD) | Get
GetList
GetListPaged
Insert
Update
Delete(List)
RecordCount | | :heavy_check_mark: | |
- Can create WHERE clauses from objects
- Generates GUID keys
## Installation
Simply add the nuget package [PeregrineDb](https://www.nuget.org/packages/PeregrineDb/) to your project.
## Licensing and Attribution
This project can be used and distributed under the [MIT License](LICENSE).
Please read [Notice](NOTICE.md) for licenses of other projects used by or inspirations of this projects.