重写NHibernate的应用程序在LINQ to SQL [英] Rewriting NHibernate app in Linq to SQL

查看:136
本文介绍了重写NHibernate的应用程序在LINQ to SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用NHibernate写旧的过时的应用程序。现在我想改写它包括新的功能和模型大的变化。

I have an old outdated application written using NHibernate. Now I would like to rewrite it including new functionality and big changes in model.

什么是使用LINQ to SQL的,而不是NHibernate的主要缺点是什么?

What are main disadvantages of using Linq to SQL instead of NHibernate ?

什么是使用LINQ中可能出现的问题到SQL,并使得DataContext的,就像这样的单身可以给表现不佳?

What are possible problems of using LINQ to SQL, does making DataContext as something like singleton can give poor performance?

推荐答案

从的在DAL封装数据访问虚假的神话:

From "The false myth of encapsulating data access in the DAL":

我想设计使用NHibernate的系统/应用程序,但我
也希望如此灵活,在未来,如果我拔掉NHibernate的
和使用ADO.NET实体框架或其他框架,然后我的
应用程序不应该崩溃。

"I would like to design a system/application using NHibernate. But I also want to so flexible that in future ,if I unplug the NHibernate and use ADO.NET Entity framework or other framework then my application should not crash."

在总之,我彻底反对为
甚至还试图做这样的事情。

In short, I am completely opposed for even trying doing something like that.

这是基于有缺陷的假设

很多背后的驱动器是一个基于建于
,其中的数据访问层
使用其
自己直接访问数据库当时的历史驱动器上的
方言,导致需要
创造这样在
以支持多个数据库的封装。

A lot of the drive behind this is based on the historical drive built in the time where data access layers directly accessed a database using its own dialect, resulting in the need to create just such an encapsulation in order to support multiple databases.

与此驱动器的问题是,它
不再是一个因素,所有现代
或/ MS能够有效地处理多个数据库
。此外,现代或/ M是
不再只是方式来执行一些
SQL和得到的结果回来了,这是
旧式DAL是如何写的。一个
或/ M呈现出更多的
的责任,从像
改变的事情,从确保乐观并发
,来管理与$最佳通信跟踪,缓存管理,
b $ b中的数据库。

The issue with this drive is that it is no longer a factor, all modern OR/Ms can handle multiple databases effectively. Moreover, modern OR/M are no longer just ways to execute some SQL and get a result back, which is how old style DAL were written. An OR/M takes on a lot more responsibilities, from things like change tracking to cache management, from ensuring optimistic concurrency to managing optimal communication with the database.

和这些功能的事,很多。没有
不仅如此,但他们每个OR / M之间不同的

And those features matter, a lot. Not only that, but they are different between each OR/M.

它不工作,你会发现得太晚

的主要问题是,无论多么
你怎么努力,也将是
微妙而不是不同的OR /小姐之间如此微妙的差别
,这些变化
可以大大影响你如何建立
你的应用程序。

The main problem is that no matter how hard you try, there are going to be subtle and not so subtle differences between different OR/Ms, those changes can drastically affect how you build your application.

< STRONG>那么,你如何与移动或/小姐?

有原因,为什么有些人想从一个数据访问技术转移到另一个。我参与了几个这样的努力,我们在每一个这些案件中使用的方法是的移植,而不是试图砸一个新的IDataAccess实现。

There are reasons why some people want to move from one data access technology to the other. I was involved in several such efforts, and the approach that we used in each of those cases was porting, rather than trying to drop a new IDataAccess implementation.

这篇关于重写NHibernate的应用程序在LINQ to SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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