3 ms·
I’m a big fan of the “middle ground” micro-ORMs like Dapper or Diesel. Write your queries in SQL, but you get to have your strong typing and automatic result s
by jiggawatts 3y ago
I’m a big fan of the “middle ground” micro-ORMs like Dapper or Diesel.
Write your queries in SQL, but you get to have your strong typing and automatic result set to objects mappings. Productivity combined with the full-featured “real” query language.
Also, I’ve become a fan of using the object mappers only for read-only queries. Updates occur via the command pattern — stored procedures. These can be mapped through to look like native methods.
- gmac 3y agoYes, the middle ground is great. In TypeScript there’s Kysely or Zapatos (mine), for example.
- mvdtnz 3y agoAbsolutely. Dapper is easily the most pleasurable data access solution I have worked with. Developers need to stop pretending SQL doesn't exist and just embrace it.
- zmj 3y agoI think this is the sweet spot. Last time I worked with SQLite on .NET I wrote a wrapper library along those lines: https://github.com/zmj/sqlite-fast https://github.com/zmj/sqlite-fast
- calvinmorrison 3y agoPersonally I like not having to either write my own model functions which just map back to sql, or having to write a boilerplate php to do parameterized queries correctly. Eloquent abstracts enough of that crap out of my way i can focus on the logic. Sincerely someone rewriting an 'old' php app that is just arrays and queries to something using models and eloquent, what a game changer
- BafS 3y agoEloquent is one of the worst ORM I worked with. It works until it doesn't, there is too much magic and it mixes SQL/Entity in the same class. Since then I use doctrine and/or repository pattern which makes the code more extensible and testable, it's also trivial to do your own raw SQL request and map it to your entity if you don't want to rely on an ORM.