Battle .NET Data® asked
l Special explanation
This article is divided into 23 paragraphs, non-author intentionally, is 64K by 9CBS published in the article.
Although there are few days without reaching 64K, it is estimated that HTML SOURCE exceeds this field.
Surrounded, so you have to segment alone (mostly the source code), please understand.
If you have a friend who needs your full document, please send me an email:
Xfzhang@microsoft.com
l
This discussion is a continuation of the last part "Analysis of Data Access Layer Technology under the .NET", but can also independently enrollment, to highlight the theme, the author deliberately changed a title.
About last content, you can refer to the following link:
http://www.9cbs.net/develop/read_article.asp?id=26689 (a total of six, ID from 26689 to 26694. can also be accessed by dev.9cbs.net -> windows / .net)
In the following discussion, in order to unify, the author temporarily refers to the data access layer is referred to as DAL (Data Access Layer). In "My Plan", the author will introduce another "DATA Access Logic" to avoid ambiguity, all Data Access Logic will retain the full name and no longer use the abbreviation.
It is important to specify that all the code listed below is implemented based on .NET Framework 1.2, you can also simulate. NET Framework 1.1, but update content in some ADO.NET 2.0 may not be used, such as: Objectspaces, DBDataReader et al.
You can use the .NET Framework 1.2:
(1) Install whidbey (beta) or Visual Studio .NET 2005 (Preview), this is the easiest way;
(2) Install .NET Framework 1.2 Runtime (Redistributables), develop using Visual Studio .NET 2003 (Vistual Studio .NET 2002). This way you need to pay attention to two points.
i. For Windows Application, make the following settings in App.config:
startup>
configure>
For Web Application, no settings do not need, have automatically added support for IIS after installation .NET Framework 1.2 runtime;
Ii. Although the project supports the .NET Framework 1.2 can be compiled by Visual Studio .NET 2003, the debugging function will not work (which friend knows how to solve this problem?)!
In addition, .NET Framework 1.2 Runtime can also be automatically obtained by installing Microsoft Yukon (Beta).
OK, the collateral is correct, the following part is my solution.
l My program
The last discussion is mainly concentrated in existing technologies, and at the same time, there are also some analyzes for different technologies in achieving DAL, and it is integrated, nothing more than such a few:
(1) ADO.NET
ADO.NET is the basic way to use .NET to use .NET for DAL development, DAL, which includes all kinds of implementations that provide simpler calls after encapsulation of ADO.NET, classic examples such as Duwamish, Petshop, etc .;
(2) O / R mapping
Since the .NET Framework 1.2 / 2.0 has not officially released, the ObjectSpaces technology contains the preferred weapon for DAL development under .NET, but with the gradual maturity of various ORM Framework and some development vendors Efforts, this is a momentum that is thrown.
(3) x / y mapping
Here, X / Y Mapping refers to other types of Data mapping other than the above O / R mapping, such as XML TO RELATION MAPPING, RELATION TO XML MAPPING, Object to XML Mapping, etc., this part of this part is not focus on this article, the author will Another discussion;
(4) Distributed Process
Strictly speaking, this is not the truly DAL technology, and it is only a discount on the sky. However, it is precisely because of the likelihood of DAL distributed processing, the author is classified separately in its own scheme and does not realize it as the main characteristics of DAL. This technology has long been familiar with: .NET Remoting, WebServices.
Hereinafter, the author will give a solution, through example, and to explore the DAL implementation technology under the .NET with everyone.
u Comprehensive existing technology
1 Overview
Said to be a solution, in fact, it is a "hodgepodge". The author hopes to achieve the inert painful painful to write DAL for DAL for different projects through comprehensive existing .NET DAL technology. Although it is absolutely not a silver bomb, I also want to make a little improvement for one of the "victim" J) DAL engineers. In addition, Ease of Use is another problem that this solution must consider!
For simplicity, the author's solution is simply referred to as: DAF (Data Access Facade) Solution.
In general, there are two aspects of the author's personal point of view, and Dal Generic requires us to focus on:
(1) Interface consistency: This most Solution can be satisfied, but there is a little more annoying, it is Data Entity! This is a very difficult Gneric guy, often gains anger.
(2) Storage independence: Database can be implemented via Provider Factory, but XML and Database mixed storage mode is more troublesome! With the gradual popularization of XML in the application (Yukon even integrated into Database Table Column), DAL will inevitably interact with it (of course, there is also a variable phase practice can also solve this problem: all The XML problem is all from Dal outside the DAL. J) Next: http://www.9cbs.net/develop/read_article.asp? Id = 27544