https://github.com/dynaspan/extended-dapper
[Preview] Extension for the Dapper Micro-ORM, providing OneToMany & ManyToOne mappings, repositories (CRUD) and native LINQ 2 SQL.
https://github.com/dynaspan/extended-dapper
crud csharp dapper dapper-crud dapper-extensions dapper-microorm dotnet dotnet-standard entityrepository linq linq-to-sql mariadb mysql orm repository sql sqlite sqlserver
Last synced: 11 days ago
JSON representation
[Preview] Extension for the Dapper Micro-ORM, providing OneToMany & ManyToOne mappings, repositories (CRUD) and native LINQ 2 SQL.
- Host: GitHub
- URL: https://github.com/dynaspan/extended-dapper
- Owner: DynaSpan
- License: mit
- Created: 2019-05-07T09:13:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-11-13T12:30:39.000Z (2 months ago)
- Last Synced: 2025-12-21T12:21:45.558Z (about 1 month ago)
- Topics: crud, csharp, dapper, dapper-crud, dapper-extensions, dapper-microorm, dotnet, dotnet-standard, entityrepository, linq, linq-to-sql, mariadb, mysql, orm, repository, sql, sqlite, sqlserver
- Language: C#
- Homepage:
- Size: 327 KB
- Stars: 5
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Extended Dapper (preview)
## WARNING: UNMAINTAINED! DO NOT USE FOR NEW PROJECTS
Extends Dapper with a repository (CRUD) and native LINQ 2 SQL and `OneToMany` & `ManyToOne` mappings.
## Getting started
[View here](docs/getting-started.md)
## Features
- Implements repositories with `CRUD` actions such as `Insert`, `Update`, `Get`, `GetById`, `GetAll` & `Delete` on top of Dapper.
- QueryBuilder for custom SQL select queries
- LINQ queries/searches executed as native SQL queries (no client-side filtering).
- Support for `OneToMany` and `ManyToOne` attributes on entity properties.
- Choose per `Get(All)` which children you want to include
- Lazy loading with dedicated methods
- Support for SQLite, MSSQL and MySQL/MariaDB. More planned in the near future.
## Changelog
[View here](CHANGELOG.md)
## Known issues
- CI/CD pipeline not working due to new testing implementation
- None; if you find one; please create an issue :)
## TODO
- Write more unittests (working on it, EntityRepository is covered)
- Add unittests for non-standard object/SQL formats (e.g. weird pk's)
- ~Setup CI/CD for automated deployment to NuGet~ (need to fix with new testing)
- Setup documentation
- (Proper) support for more than 1 primary key
- ~Support for autovalues other than guid/uuid~
- ~Optimize reflection calls~
- Optimize relation mapping (should be able to better implement it with Dapper)
- Implement more `SqlProviders`
- Lazy loading of `OneToMany` and `ManyToOne` (semi-implemented; loading must be done manually)
- Implement `ManyToMany` attribute
- Do benchmarks
## Example
An example of retrieving an entity from the database:
var scienceAnswersBook = (await this.BookRepository.GetQueryBuilder()
.Select(b => b.Name, b => b.ReleaseYear)
.IncludeChild(b => b.Author, a => a.Name, a => a.Country)
.IncludeChild(b => b.CoAuthor, a => a.Name, a => a.Country)
.IncludeChild(b => b.Category, c => c.Name)
.Where(b => b.Name == "Science questions answered")
.GetResults()).First();
## Building
Build the library by running `dotnet build -c Release` or `dotnet publish -c Release`.
## Testing
You can run the unittests against the sqlite, MySQL and MSSQL backends with Docker. Issue the following commands:
docker-compose build
docker-compose up --abort-on-container-exit