Hacker News new | ask | show | jobs
by scarface74 2776 days ago
I'm talking about the developers who never discovered ORMs until MS pushed theirs

Because every ORM sucks outside of the ones built on top of Linq.

Linq is great because it makes a query language a first class citizen and it decouples writing the query and the implementation.

1 comments

In all fairness, you should consider Entity Framework, not Linq, when speaking about ORMs. And the first versions of EF sucked compared to the others frameworks that were available at the time.
It’s not just about EF. The beauty of C# and Linq is:

Linq => expression trees => provider => native query language of data source => data source.

Written correctly, you can pass expressions around like:

repo.Find(c => c.age > 65 && c.gender == “male”)

And the expression can be interpreted at runtime by either EF creating native sql or the Mongo driver creating a native MongoQuery or even an in memory List for unit testing.

No matter how good another ORM may be for another language, what made C#s implementation better was Linq + expression trees.

Except EF is basically the only provider that works 100% robustly. I have some pretty bad memories of getting NHibernate's Linq provider to work correctly, since it would just randomly mistranslate queries or flat-out throw exceptions.
As someone who has switched almost entirely away from .net to go, this is absolutely untrue. I'm fairly certain the issue was PEBKAC
The Mongo Linq driver is excellent. It’s not exactly an ORM, but it does let you work with strongly type collections and the queries it produces are pretty good.

There was also another Linq/ORM I used back in the day for Postgres. I can’t remember the name of it.