本文介绍了你会选择与传统数据库的工作是什么ORM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在集成一些遗留系统的过程。他们每个人都有不同的数据库;我需要写数据访问$ C $下其中的大部分。

I am in the process of integrating a number of legacy systems. They each have different databases; and I will need to write data access code for most of them.

数据库模式不能改变(我也许可以运用一些指标等,但表和字段必须保留结构)。有些数据库都有一个确定的设计,appropiate relationsships和主/外键和其他的一些数据库缺少了很多。

The database schemas cannot be changed (I might be able to apply some indexes and such, but tables and their columns must retain the structure). Some of the databases has an OK design, with appropiate relationsships and primary / foreign keys, and some of the other databases lacks that very much.

哪个ORM,你会选择这个任务?我想用同样的ORM防空火炮的项目;我的要求是:

Which ORM would you choose for this task ? I would like to use the same ORM accross the project; and my requirements are:

  • 能够重命名code表或列;但保留了老字号在数据库中。
  • 在合理code一代
  • 高效LINQ的支持(对数据模型的LINQ查询应转换为有效的SQL)。
  • 在生成的数据类应preferably是 POCO的
  • $ p表示不同的数据库引擎$ pferably支持。
  • Ability to rename tables or columns in code; but retain the old name in the database.
  • Reasonable code generation
  • Efficient LINQ support (LINQ queries against the data model should be translated to efficient SQL).
  • Generated data classes should preferably be POCO's.
  • Preferably support for different database engines.

我目前最有经验的LINQ到SQL;但我有一种感觉这可能是该项目的错误选择。我愿意花些时间在学习一门新的框架。

I currently have the most experience with LINQ-To-SQL; but I have a feeling it might be the wrong choice for this project. I am willing to invest some time in learning a new framework.

推荐答案

在猜测,我认为一个ORM可能会引起你更多的麻烦比它节省。如果你有几个不同的遗留数据库,其中一些是设计不当,您可能会发现更容易在较低的水平比ORM建立数据访问层。福勒的企业应用架构模式做编目各种方法来构建数据访问的不错的了层。

At a guess, I think an ORM might cause you more trouble than it saves. If you have several different legacy databases where some of them are poorly designed, you might find it easier to build the data access layer at a lower level than an ORM. Fowler's Patterns of Enterprise Application Architecture does quite a good job of cataloguing various approaches to structuring data access layers.

一些数据访问层可能是适合于code代解决方案;然而,多种模式(有些凌乱像你说的)在presence表明,一个尺寸适合所有人的方法可能无法工作,或者可能需要付出的努力过,使之与所有的遗留数据库很好地发挥。

Some of the data access layer might be amenable to a code generation solution; however the presence of a variety of schemas (some messy as you say) suggests that a one-size-fits-all approach may not work, or may involve disproportionate effort to make it play nicely with all of the legacy databases.

这篇关于你会选择与传统数据库的工作是什么ORM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 03:37