Since the technology stack on the wiki states that the ORM for this project is still undecided I figured its time to decide an ORM.
These are the most viable options:
Entity framework
https://github.com/dotnet/efcore
EF is a framework that lets you query the database with an IQueryable approach and execute updates on the database using a unit of work pattern. All queries are executed via linq. There is mostly no SQL to write (though it does permit you to write it).
Pros
- Widely known and used
- Supported by MS and tested over the last 10 years or so
- Has great support for migrations and the audit tables we are making
- Has easy support and integration with most libraries
- Supports most major databases including Postgre
- Heavily extensible to a similar fashion as how .net core is
Cons
- A pretty big overhead. Sometimes double than the rest. See the table at https://github.com/StackExchange/Dapper
- If we want to use some libraries and they don’t have support for EF we won’t be able to use them.
- If we decide at some point that EF doesn’t suit us for some reason at some point then we are stuck and it’ll be extremely difficult to change - hence its a framework, not a library.
Dapper
https://github.com/StackExchange/Dapper
Dapper is a library which its main job is to map database tables to classes.
Made by Marc Gravell () and the SE team
Pros
- Pretty fast
- No limitations in libraries, can write SQL freely.
- Has a few libraries that can help with some basic functionalities like Dapper.Contrib or you can make your own pretty easily.
Cons
- Needs a lot more configuration and architectural planning
- Need to write your own migrations - ie fluent migrator or some other kind of library
- This is my opinion but in big projects it eventually leads to writing your own full ORM using dapper as a base.
Linq2db
https://github.com/linq2db/linq2db
Somewhat a combination of dapper and EF. You write linq and it converts it to sql queries. Maps the results to classes.
Pros
- Fastest
- Simple to use and understand
- (Isn’t related to MS or SE)
Cons
- Same cons as Dapper.
Considerations
To iterate here the most important things to consider:
- Migration
- Automatic actions such as adding the update_date/update_by etc should be done by the backend with the help of the ORM.
- Having an actual proper design pattern (ie unit of work) in your ORM helps to build the bigger architure in many ways.
- Speed.
Omitted ORMS
NHibernate - No experience in this.
No ORM - I don’t see a point when you can just Dapper.