Re:Is ORM still an anti-pattern?
by scarface_74 on Tuesday June 27, 2023 @05:53PM
(#36499184)
LINQ is a query builder and the .Net runtime creates expression trees. Entity Framework translates the expression tree to SQL and maps data back to objects.
Re:Is ORM still an anti-pattern?
by throwawaymaths on Tuesday June 27, 2023 @07:14PM
(#36500032)
And iirc you can use databases in .net with Linq only and pass on entity framework, if you so chose
Re:Is ORM still an anti-pattern?
by scarface_74 on Tuesday June 27, 2023 @07:55PM
(#36500402)
Linq2SQL was a thing. I’m not even sure if it is still supported.
Linq is really just a high level abstraction for querying any data that can be queried. EF adds some more abstractions mostly related to mapping C# objects to database tables. Then it adds database specific query providers (implementations) that combine the (abstract) linq query and the mapping to produce sql.
You can really use linq to query anything (APIs, for example), including databases without using EF. It's just not very common because building a custom query provider is a lot of work.
Re:Is ORM still an anti-pattern?
by throwawaymaths on Tuesday June 27, 2023 @07:13PM
(#36500014)
Clarifying: ORMs are gross, query builders are not.
Re:Is ORM still an anti-pattern?
by geraldwhen on Tuesday June 27, 2023 @08:13PM
(#36500543)
TypeORM thinks it’s an ORM but it doesn’t do what you say. It’s pretty good at writing basic migrations from annotations, but that’s about it.
It's kinda gross because the developer needs to make a decision about what is authoritative source of truth, the programming model makes you feel like you can trust your code (probably the wrong choice), and all the footguns around distributed state kick in (possibly even worse if you have a frontend with two way data binding and data structures that last longer than an http request in your backend)