Giter Club home page Giter Club logo

extended-dapper's Introduction

Extended Dapper (preview)

Nuget (with prereleases)

Extends Dapper with a repository (CRUD) and native LINQ 2 SQL and OneToMany & ManyToOne mappings.

This is a preview and might contain bugs Though it has been been tested in various (non-critical) production environments and the EntityRepository is almost 100% covered by tests

Getting started

View here

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

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<Author>(b => b.Author, a => a.Name, a => a.Country)
    .IncludeChild<Author>(b => b.CoAuthor, a => a.Name, a => a.Country)
    .IncludeChild<Category>(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

extended-dapper's People

Contributors

dynaspan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.