原始SQL vs基于OOP的查询(ORM)? [英] Raw SQL vs OOP based queries (ORM)?

查看:82
本文介绍了原始SQL vs基于OOP的查询(ORM)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,需要频繁的数据库访问,插入和删除.我应该使用Raw SQL命令还是应该使用ORM技术?该项目可以在没有任何对象且仅使用SQL命令的情况下正常运行?这会总体上影响可扩展性吗?

I was doing a project that requires frequent database access, insertions and deletions. Should I go for Raw SQL commands or should I prefer to go with an ORM technique? The project can work fine without any objects and using only SQL commands? Does this affect scalability in general?

编辑:项目是不向用户提供我的内容,但用户生成内容且项目在线的类型之一.因此,内容的数量取决于用户的数量,如果该项目甚至有50000个用户,而且每个用户都可以创建内容或阅读内容,那么最合适的方法是什么?

EDIT: The project is one of the types where the user isn't provided with my content, but the user generates content, and the project is online. So, the amount of content depends upon the number of users, and if the project has even 50000 users, and additionally every user can create content or read content, then what would be the most apt approach?

推荐答案

我想最好以最简单的方式实现目标. 如果使用ORM并没有真正的附加优势,并且应用程序非常简单,那么我就不会使用ORM. 如果应用程序确实要处理大量数据,并且没有业务逻辑,那么我就不会使用ORM.

I'd say it's better to try to achieve the objective in the most simple way possible. If using an ORM has no real added advantage, and the application is fairly simple, I would not use an ORM. If the application is really about processing large sets of data, and there is no business logic, I would not use an ORM.

但这并不意味着您不应该设计应用程序属性,而是再次:如果使用ORM不能给您带来任何好处,那么为什么要使用它呢?

That doesn't mean that you shouldn't design your application property though, but again: if using an ORM doesn't give you any benefit, then why should you use it ?

这篇关于原始SQL vs基于OOP的查询(ORM)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆