Combat. Net data Access Layer-1

Source: Internet
Author: User
Tags visual studio
Access to | data-Actual. Net Data Access Layer



L Special Note

The actual combat is divided into 23 paragraphs, not the author intends to do so, is subject to the CSDN published article 64K Limited.

Although there are a few segments that do not reach 64K at all, it is estimated that HTML source exceeds this fan

Wai, so also have to separate subparagraph (mostly source code), please understand.

If a friend needs a complete document, please email me:

Mailto:xuefeng.zhang@bearingpoint.com

L Introduction

This discussion is a continuation of the previous section, "Analyzing the data access layer technology under. Net", but can also be independent, for the purpose of highlighting the theme, the author deliberately changed a title.



About the last content, you can refer to the following links:

http://www.csdn.net/Develop/read_article.asp?id=26689 (altogether six, IDs from 26689 to 26694.) can also pass Dev.csdn.net-> windows/. NET for access)



In the following discussion, for the sake of unification, the author temporarily referred to the data Access layer as the Dal (Layer). In my scenario, the author introduces another "DAL" (data access Logic), and to avoid ambiguity, all Data access Logic will retain their full name and no longer use abbreviations.



Specifically, the code listed below is all based on the. NET Framework 1.2 implementation, or you can simulate on the. NET Framework 1.1, but updates in some Ado.net 2.0 may not be available, such as: ObjectSpaces, DbDataReader and so on.

You can use the. NET Framework 1.2 in two ways:

(1) Install Whidbey (Beta) or Visual Studio. NET (Preview), which is the simplest method;

(2) Install the. NET Framework 1.2 Runtime (Redistributables) and develop it using Visual Studio. NET 2003, which does not support Vistual studio. NET 2002. This approach requires attention to two points:

For Windows application, make the following settings in app.config:

<configuration>

<startup>

<supportedruntime version= "v1.2.30703"/>

</startup>

</configuration>

For Web application, there is no setup required, and support for IIS has been automatically added after the. NET Framework 1.2 runtime has been installed;

II. Although projects that support the. NET Framework 1.2 can be compiled through visual Studio. NET 2003, the debugging feature will have no effect (which friend knows how to solve the problem?). )!

In addition, the. NET Framework 1.2 Runtime can also be automatically obtained by installing Microsoft Yukon (Beta).



Ok, the next part is my plan.



L my plan.

The last discussion focused on existing technologies, while at the same time making some analysis of the differences in the implementation of the DAL by different technologies, it is a combination of the following:

(1) ado.net

Ado. NET is the basic way of using. NET to develop the DAL in the current stage, the DAL here also includes various kinds of implementations that provide simpler invocation after ado.net encapsulation, such as: Duwamish,petshop, etc.

(2) O/R Mapping

Because the. NET Framework 1.2/2.0 has not yet been formally released, the ObjectSpaces technology contained therein has not yet become the preferred weapon for DAL development under. NET, but with all kinds of ORM The gradual maturity of the framework and the continuous efforts of some developers, this aspect is showing a thriving momentum;

(3) x/y Mapping

The x/y Mapping here refers to all kinds of data Mapping other than the above O/R Mapping, such as XML to relation mapping,relation to XML mapping,object to XML Mapping And so on, this part of the content is not the focus of this article, the author will be another discussion of the special text;

(4) Distributed Process

Strictly speaking, this is not really the DAL technology, at best, only the icing on the cake. However, because of the possibility of the DAL distributed processing, the author classifies it separately in its own scheme, and does not implement it as the main feature of the DAL. This technology has long been familiar to us:. NET remoting,webservices.



Below, the author will give a solution of his own, through the example, and we discuss. NET under the technology of DAL implementation.



U Synthesis of existing technologies

1. Overview

The solution, in fact, is a "hodgepodge", the author hopes that by synthesizing the existing. NET DAL technology to achieve the generic goal, eliminating the endless pain of writing the DAL for different projects, although it is definitely not silver bullet, always want to be the general (I am also "victim" One j) Dal engineers bring a little improvement. In addition, Ease of use is another challenge that this solution must consider!

For simplicity, the following is referred to as the author's solution: DAF (Data Access façade) Solution.



In general, the DAL generic has two aspects to focus on in the author's personal opinion:



(1) Interface consistency: This most solution can be satisfied, but a bit more annoying, is the design of data entity! It's a hard generic guy, and it's a lot of things to do.

(2) Storage independence: Database can be implemented through provider factory, but the mixed storage mode between XML and database is troublesome! As XML becomes increasingly popular in the application (Yukon even integrates it into the database Table column), the DAL will inevitably interact with it L (of course, there is also a disguised way to solve this problem: Isolate all XML problems outside the Dal j)



Next paragraph: http://www.csdn.net/develop/Read_Article.asp?id=27544


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.