设计DAL在.NET是和QUOT;数据源无关"而不仅仅是"独立于数据库"?而不、数据源、仅仅是、独立

2023-09-06 22:56:38 作者:不二臣.

如何设计这种灵活的DAL(特别是在.NET)?

How to design such flexible DAL (specifically in .NET) ?

哪些接口.NET提供了,应该怎么对我自己做?

What interfaces .NET provides and what should be done on my own ?

它是一个新建项目启动与SQL Server作为数据源,但在未来,它的某些部分会移动到不同的NoSQL型数据存储。

Its a greenfield project starting with SQL Server as data source but in future, parts of it will move to different NoSQL type of datastores.

此外,我们可能需要尝试很多不同的数据存储(如一些数据可能要与卡桑德拉,有的用RDBMS,一些其他DHT等)

Also, we may need to experiment with lot of different datastores (like some data may have to go with Cassandra, some with RDBMS, some to other DHT etc.)

因此​​很容易切换接入层是必要的。所有我知道现在的问题是需要对这些数据的操作。

Therefore easily switchable access layer will be needed. All i know right now is the 'data' and 'operations needed on that data'.

推荐答案

简单:你不知道。 THS与其说是关于技术的,但对不同存储之间完全不同的行为特征。

Simply: you do not. Ths is not so much about technology, but about totally different behavioral characteristics between different stores.

例如,SQL真正的亮点在查询中,任何像样的DAL将揭露那些在一个动态的方式(i..e没有GetCustomerById功能)。

For example, SQL really shines in queries, and any decent DAL will expose those in a dynamic fashion (i..e no "GetCustomerById" function).

与XML文件替换,这将是可怕的,并投入了大量的压力在DAL方 - 你需要重新实现没有正确的光盘结构的一个非常强大的搜索语义来加快它

Replacing this with a XML File will be horrific and put a lot of stress on the DAL side - you need to reimplement a very powerfull search semantics without the proper disc structures to speed it up.

大多数NoSQL数据存储认真ysuck一旦你习惯了正确的关系定理。它们不是compareable在行为和功能,并作为这样一个DAL可以在一个非平凡项目不是抽象此远

Most NoSQL data stores seriously ysuck once you get used to the proper relational theorem. They are not compareable in behavior and functionality, and as such a DAL can not abstract this away in a nontrivial project.