ORM Tips
ORM小窍门

More and more people are using Object to Relational Mapping (ORM) tools to jump the divide between application code that is object oriented and a database that is storing information in a relational manner. These tools are excellent and radically improve development speed. But, there are a few ‘gotchas’ to know about.
越来越多的人正在使用对象关系映射(ORM)作为越过面向对象应用程序代码和关系型存储数据库之间鸿沟的工具。这些工具很优秀从根本上提高了开发速度。但是有一些“陷阱”需要知道。

(42)Avoid following the ‘Hello World’ examples provided with your ORM tool that turns it into an Object to Object Mapping. Database storage is not the same as objects for a reason. You should still have a relational storage design within a relational storage engine such as SQL Server.

招数42:

避免按照你的ORM工具提供的‘Hello World’ 示例以至于把他变成对象到对象的映射。数据库存储和对象存储不一样是有原因的。你应该还有一个在关系型存储引擎比如:SQL Server的设计。

(43)Parameterized queries are exactly the same as stored procedures in terms of performance and memory management. Since most ORM tools can use either stored procedures or parameterized queries, be sure you’re coding to these constructs and not hard-coding values into your T-SQL queries.

招数43:

参数化查询与存储过程在性能和内存管理方面是完全一样的。然而大多数ORM工具可以使用存储过程或参数化查询,确保你根据这些结构进行编码而不要硬编码值到你的T-SQL查询中。

(44)Create, Read, Update, and Delete (CRUD) queries can all be generated from the ORM tool without the need for intervention. But, the Read queries generated are frequently very inefficient. Consider writing a stored procedure for complex Read queries.

招数44:

创建,读取,更新和删除(CRUD)查询都可以通过ORM工具生成不需要干预。但是,生成的读取查询常常是非常低效的。考虑写一个存储过程用于复杂的读取查询。

(45)Since the code generated from the ORM can frequently be ad hoc, ensure that the SQL Server instance has ‘Optimize for Ad Hoc’ enabled. This will store a plan stub in memory the first time a query is passed, rather than storing a full plan. This can help with memory management.

招数45:

由于从ORM生成的代码可以经常被 ad hoc,确保SQL服务器实例已经开启了‘对Ad Hoc优化’。在第一次获得查询后,将在内存中存储一个计划存根,而不是存储一个完整的计划。这样有利于内存管理。

(46)Be sure your code is generating a parameter size equivalent to the data type defined within table in the database. Some ORM tools size the parameter to the size of the value passed. This can lead to serious performance problems.

招数46:

确保你正在生成的代码与数据库中表数据类型定义的参数大小相当。一些ORM工具按照传输值设置参数大小。这可能会导致严重的性能问题。

最新文章

  1. 社区O2O的发展与未来
  2. MIT jos 6.828 Fall 2014 训练记录(lab 4)
  3. "/Date(1405056837780)/" 时间转换
  4. Centos7升级gcc学习笔记
  5. uva 1449 - Dominating Patterns
  6. zabbix 基于JMX的Tomcat监控
  7. C++程序设计实践指导1.8求指定范围内的所有素数改写要求实现
  8. 谈谈Linux内存释放
  9. C#多线程编程实例 螺纹与窗口交互
  10. SELinux开启和关闭
  11. 触发器(基本的SR触发器、同步触发器、D触发器)
  12. k近邻法(KNN)知识点概括
  13. 201521123121 《JAVA程序设计》第7周学习总结
  14. 错误:Unsupported major.minor version 51.0的解决
  15. [struts2学习笔记] 第五节 编写struts2的action代码
  16. 解决iframe在移动端(主要iPhone)上的问题
  17. Xmanager power suit 6 最新版注册激活
  18. element-ui MessageBox的bug
  19. 转:浅谈char类型范围
  20. 自定义NSOperation下载图片

热门文章

  1. UVA 550 Multiplying by Rotation (简单递推)
  2. shell脚本实例
  3. “FormCRUD.csProj.FormMain.Name”隐藏了继承的成员“System.Windows.Forms.Control.Name”。如果是有意隐藏,请使用关键字 new。
  4. .Net刷新页面的小结
  5. Visual Studio 2010 Rebuild问题
  6. IOS Swizzle(hook)
  7. HTML 5:绘制旋转的太极图
  8. 多校5 HDU5787 K-wolf Number 数位DP
  9. Unity3d自定义脚本模板
  10. 基础排序算法,java实现(快速,冒泡,选择,堆排序,插入)