Hacker News new | ask | show | jobs
by camus 4629 days ago
most ORMs have a query language too, it's not just "Linq". Orms are good for development purposes and you can always do raw SQL queries within ORMs at some point.
1 comments

The thing that's nice about Linq is the integration. You can directly reference variables in the things you're querying, and then either fill in an instance of an existing class, or generate an anonymous object.

For example:

  var query = from c in customers
              join o in orders on c.ID equals o.ID
              select new {
                c.Name,
                o.Product,
                Address = c.MailingAddress
              };
Of course, anonymous objects in C# can be a pain in the ass, since you can't usefully return them from a method. Something like Scala's structural types would solve that problem.

I don't really like C# that much as a language, but I do like the Linq approach.