[. Net open-source sharing] dataprovider convenient data access component

Source: Internet
Author: User

Reference content

1 Overview of dataprovider

1.1 Background

1.1.1 headache

Create a data access layer from scratch
Without the data access layer of the business, it is easy to develop and maintain.
Although the traditional ADO. NET is powerful, it is not satisfactory in terms of development efficiency and development difficulty.
The number of database tables is large, and the relationship is complex. The workload at the data access layer is very large.
SQL code is often found at runtime, rather than the expected compilation stage, affecting the project quality.
Debug always traces SQL statements or stored procedures at the data layer.
Although SQL is powerful, it is not an efficient and easy-to-develop method from the object-oriented perspective. It is difficult for new users to get started, and it is even more difficult to solve online problems in real time.

1.1.2 expected situation

In the face of objects, a unified data access interface is stripped to minimize the coupling between layers.
All the stupid Code no longer needs a line of key.
Support for multiple databases

1.1.3 coming soon

Dataprovider (hereinafter referred to as "DP") is accompanied by ppcoder.

1.2 What is DP
In the. NET environment, the data access layer solution includes a data access component dataprovider. dll and a code automation tool ppcoder. It is used in software systems developed with multi-layer architecture.

1.3 features of DP

The data access layer does not need to write a line of code, but only needs to design a database
The database must have at least one constraint: ID, primary key, and unique
You can configure a primary/foreign key relationship between data tables to enable the associated query mode.
Supports SQL Server and MS Access databases
The stored procedure interacts with SQL Server. The stored procedure is generated by ppcoder.
The two databases can be switched seamlessly. To ensure the consistency of the structure, you only need to regenerate the entity class.
Simple data operation method call
Supports transactions for the data volume class
Supports direct SQL statements
Powerful Data Query Functions
Cache data
Multiple query delimiters: range, returned quantity, distinct, associated query, not equal
Return to the current page: return data on the specified page
Multiple types of responses: dataset, reader, and databox

1.4 benefits of DP

Simplify system development into database design and business function development, saving manpower
Reduce system coupling, separate data access from business, and improve project maintainability
When the database structure is frequently changed, the project is no longer dragged down by the data access layer.
Supports multiple databases to improve system scalability

2 instructions
For details, see the product manual and dataprovider class library descriptions.
3 Q &

3.1 functional aspects

A little dizzy. What is the relationship between ppcoder and dataprovider?
Dataprovider is a middleware that processes data access.
Ppcoder is an auxiliary tool used with it to help automatically generate entity classes (or stored procedures) with specific structures)

What databases does dataprovider support?
Currently, SQL Server and MS Access are supported. Support for Oracle databases will be considered in the future.
A prominent feature of DP is that databases with the same structure can be seamlessly switched. If MS Access is used as a database due to cost and scale, it will be very easy to convert it into SQL server in the future. You only need to use ppcoder to regenerate the entity. The original code does not need to be changed.
3.2 Application
Do you have any special requirements for database design when using DP?
DP requires that each table contain at least one of the primary key, identifier, or unique key to locate a unique data record. In addition, note that when an object is generated, each constraint combination corresponds to a constructor. Therefore, constraints in the same parameter format cannot be combined. For example, the following design is invalid: Define rowid as the primary key, and define a productid as the unique key.
The error "database timeout" is always reported because the data to be operated is large. Is there a solution?
The timeout is because the default commandtimeout value of sqlcommand is 30, and the time required for statement execution is later than this time. To solve this problem, the initial commandtimeout value in configration is a large number, if you do not want to set the timeout value, set this value to 0.
My data tables have complex relationships. How can I obtain string tables?
There are three methods for DP to produce a link that meets the corresponding conditions. Each method is applied to different situations.
If only two tables are in series, you can use queryjoin to obtain the corresponding data. to use this method, you must establish the association between the two tables in the database before generating the object class.
Another method is to directly send SQL statements to the database and then retrieve the data through the executesql method.
Another way is to pull out the view in the database and use ppcoder to generate an object for this view. DP will treat the view as a normal table and only provide the query function for view DP, the query method is the same as that of a common table.

3.3 Products
Did DP pop out of the rock?
No, DP is the work of YU Bo. Please advise.
For more information, see http://blog.ppcode.com/article.asp? Id = 538

Do not pay for DP?
Completely free
Contact MSN: ppcode@gmail.com
QQ: 942365

Has DP considered open source?
DP is open-source. For the source code, see the link below.

3.4 technical aspect
What are the technical features of DP?
DP uses the. NET reflection technology to operate objects.
Custom attribute to record field information.
Ppcoder generation and application of codedom in. NET Framework
SQL Server uses stored procedure interaction to greatly improve performance
For detailed technical details, see the class library description.

Open source download:
Application in the. net2.0 environment:
Dataprovider_net2.0
Dataprovider_net2.0_source
Coder2.0 _ net2.0 _ Source

Application in the. net1.x environment:
Dataprovider_net1.x
Dataprovider_net1.x_source
Coder2.0 _ net1.x _ Source

 

Http://www.cnblogs.com/rexsp/archive/2007/12/04/983568.html

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.