|
|
|
|
|
by jkoudys
2529 days ago
|
|
I've always felt so alone in my distaste for ORMs. They often lead to at worst taking way more data than you need and manipulating it all in a language that's not very good at it, or at best running some kind of query-builder which takes a far more complex configuration to get the same data that a simple query could. Objects make much more sense as something to build from a query, not something to be queried themselves. If the tide is turning against ORMs, it probably has a lot to do with the rising love for fp that this author covers. Languages like SQL are declarative, as is fp, so that approach feels more natural to people these days. |
|
As an alternative, use stored procedures with Dapper, or use smaller sub-helpers that prepare most of the SQL statements or sub-statements for you but don't outright hide it. They assist in creating SQL (and prepared statement parameter mapping), but only assist, and are kept to less than a few hundreds of lines of code.
Other dark-grey-boxes include URL route mappers, seen in MVC stacks, and HTML formatters, such as Razor. When they don't work right you'll waste many many hour fudging with them. I'd often rather replace the URL router with Case/switch statements: it would be easier to debug; so what if it's a bit more typing. It's a white box.