4 ms·
So the easiest way to avoid using an ORM is to create your own ORM? What AI do you need? You map your tables to objects and relationships between objects via F
by scarface74 9y ago
So the easiest way to avoid using an ORM is to create your own ORM?
What AI do you need? You map your tables to objects and relationships between objects via FK relationships.
- pjmlp 9y agoI can get very creative with SELECTs, making use of Prolog style queries, which are fully done server side on the database. Most ORMs will download all the data and evaluate them on the client side, with code that is even more convoluted that the SQL one and thus with less performance.
- scarface74 9y agoIf your ORM is downloading all of your data and querying client side, then your ORM "is doing it wrong". Entity Framework and any other Linq to data provider translates the Linq expression to the native language of the source data and does it server side.
- pjmlp 9y agoI know EF, which is why my comment also mentions "code that is even more convoluted that the SQL one and thus with less performance". LINQ only allows for a fraction of what is possible with SQL, and good luck having the best queries generated out of it, if the RDMS doesn't happen to be SQL Server.
- scarface74 9y agoActually my DMS is sometimes Mongo and the Mongo driver does pretty well at translating Linq to Mongo Query using the aggregation framework. It all depends on the talent of the authors of the drivers.
- zzzeek 9y ago> Most ORMs will download all the data and evaluate them on the client side I've seen that pattern in lots of homegrown applications, but I've never seen such a thing in a mainstream ORM. Care to provide examples ?
- pjmlp 9y agoI've seen it a lot in entity beans and the early days of hibernate. Nowadays I only bother with Dapper, MyBatis, using a mix of SQL and stored procedures. EF only if the RDMS happens to be SQL Server.
- sergiosgc 9y ago> What AI do you need? You map your tables to objects and relationships between objects via FK relationships. That is only true in a one-to-many entity relationship (and even so, it is debatable). A one-to-one relationship can be modeled in the two objects, in one of them, or delegated to a third entity. A many-to-many entity relationship can also be handled, in OO, in various different ways. Idem for a ternary relationship or, basically any higher order relation between objects. This is known, borrowing a term from electrical engineering, as an impedance mismatch between the two models, and it's not an easy problem by any measure.