是跳跃的ORM乐队旅行车大家在这里? [英] Is everyone here jumping on the ORM band wagon?

查看:204
本文介绍了是跳跃的ORM乐队旅行车大家在这里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

微软LINQ到SQL,实体框架(EF),和NHibernate等等都提出运筹学和​​管理学作为下一代数据映射技术,并自称是轻便,快速和容易。例如像在这篇文章中刚刚发表在杂志VS:

Microsoft Linq to SQL, Entity Framework (EF), and nHibernate, etc are all proposing ORMS as the next generation of Data Mapping technologies, and are claiming to be lightweight, fast and easy. Like for example this article that just got published in VS magazine:

http://visualstudiomagazine.com/features/article.aspx?editorialsid=2583

谁都是兴奋在他们的项目实施这些技术?哪里是在这些技术,使他们比前辈如此之大的创新?

Who all are excited about implementing these technologies in their projects? Where is the innovation in these technologies that makes them so great over their predecessors?

推荐答案

我已经写了数据访问层,持久性组件,甚至我在数百种应用程序,多年来自己的ORM(我的爱好一节);我甚至实现我自己的生意事务管理器(上SO这里)。

I have written data access layers, persistence components, and even my own ORMs in hundreds of applications over the years (one of my "hobbies"); I have even implemented my own business transaction manager (discussed elsewhere on SO).

ORM工具已经存在了很长一段时间在其他平台上,如Java,Python和等等。看来,有一个新的时尚,现在微软为中心的团队已经发现了他们。总体来说,我认为这是一件好事 - 在旅途中一个必要的步骤探索和理解的架构和设计,似乎已经与.NET的到来一起引入的概念

ORM tools have been around for a long time on other platforms, such as Java, Python, etc. It appears that there is a new fad now that Microsoft-centric teams have discovered them. Overall, I think that is a good thing--a necessary step in the journey to explore and comprehend the concepts of architecture and design that seems to have been introduced along with the arrival of .NET.

底线:我总是喜欢做我自己的数据访问,而不是打一些工具,试图帮助我。这是绝对不能接受放弃我的掌控我的命运和数据访问是我的应用程序的命运的一个关键部分。一些简单的原则,使数据访问非常易于管理。

Bottom line: I would always prefer to do my own data access rather than fight some tool that is trying to "help" me. It is never acceptable to give up my control over my destiny, and data access is a critical part of my application's destiny. Some simple principles make data access very manageable.

使用模块化,抽象和封装的基本概念 - 所以包装你的平台的基础数据访问API(如ADO。 NET)用自己的层,它提出了一个抽象层更接近你的问题的空间。请勿代码直接针对API(也SO别处讨论)的所有数据访问。

Use the basic concepts of modularity, abstraction, and encapsulation--so wrap your platform's basic data access API (e.g., ADO.NET) with your own layer that raises the abstraction level closer to your problem space. DO NOT code all your data access DIRECTLY against that API (also discussed elsewhere on SO).

严重应用DRY(不要重复自己)原则=重构一大跳出你的数据访问代码。使用代码生成时,作为重构的方法合适,但寻求消除需要代码生成时,您可以。一般情况下,代码生成揭示的东西是从环境中丢失 - 语言缺乏,设计,刀具的限制,等等。

Severely apply the DRY (Don't Repeat Yourself) principle = refactor the daylights out of your data access code. Use code generation when appropriate as a means of refactoring, but seek to eliminate the need for code generation whenever you can. Generally, code generation reveals that something is missing from your environment--language deficiency, designed-in tool limitation, etc.

同时,学会使用可用的API好,特别是关于性能和稳定性,然后将这些经验融入自己的抽象的数据访问层。例如,学会正确使用在你的SQL参数,而不是嵌入文字值到SQL字符串。

Meanwhile, learn to use the available API well, particularly regarding performance and robustness, then incorporate those lessons into your own abstracted data access layer. For example, learn to make proper use of parameters in your SQL rather than embedding literal values into SQL strings.

最后,请记住,任何应用/系统,成为成功将增长到遇到性能问题。修复性能问题更多地依赖于设计出来,而不是在执行只是调整的东西。该设计的工作将影响数据库和应用程序,必须以同步改变。因此,寻求能够使这些变化很容易地(敏捷),而不是试图避免不断变化的应用程序本身。在某种程度上,最终意味着能够无需停机部署的变化。这并不难做到,如果你不设计远离它。

Finally, keep in mind that any application/system that becomes successful will grow to encounter performance problems. Fixing performance problems relies more on designing them out rather than just "tweaking" something in the implementation. That design work will affect the database and the application, which must change in sync. Therefore, seek to be able to make such changes easily (agile) rather than attempt to avoid ever changing the application itself. In part, that eventually means being able to deploy changes without downtime. It is not hard to do, if you don't "design" away from it.

这篇关于是跳跃的ORM乐队旅行车大家在这里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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