5 ms·
SQL is syntactic sugar for first order logic. It is much easier to query relational database with SQL than abstracting relations with ORM.
by biggio 8y ago
SQL is syntactic sugar for first order logic. It is much easier to query relational database with SQL than abstracting relations with ORM.
- scarface74 8y agoHow is “select * from customer where age > 18 and age < 65” Any more of an abstraction and easier than from context.Customer where c.Age > 18 && c.Age < 65 With one it’s a magic string where you could have typos. With the other you get compile time syntax checking.
- angersock 8y agoYou must not use good SQL IDEs...try Datagrip.
- scarface74 8y agoSql is part of my code that doesn’t help....
- biggio 8y agoI understood your SQL example but I don't understand your counter example.
- scarface74 8y agoThe second is LINQ within C#
- CuriouslyC 8y agoIf you use a modern IDE and extract your SQL into separate files you can get syntax checking, and even the ability to run the query on-server directly and get a table of results in a table-formatted tab with a single click. How much do you have to do to get your ORM to run your query, and are the results as easy to work with?
- scarface74 8y agoWith LINQ (I hate most other ORMs) you get objects back and you use the same query syntax for working with RDMS’s, NoSql data stores, REST APIs, in memory collections, etc. If you had an in memory list you would write: var seniors = from c in customers where c.Age > 65 If you were using an RDMS you would write: var customers = context.Customers var seniors = from c in customers where c.Age > 65 If you were using Mongo you would write: var customers = database.GetCollection<Customers>(“Customers”) var seniors = from c in customers where c.Age > 65 In each case, the query would be translated appropriately - as in memory code, SQL, or MongoQuery respectively.