speaking of the data provision Program , everyone is familiar with it. The function of the data provider is to access different data sources through a unified interface, such as oledbprovider, sqlserverprovider, or orcaleprovider. Access to different data sources is actually different. Access to Microsoft Data Sources ranges from ODBC to ADO. net has gone through many times, and various data source providers are constantly producing databases of different structures. In order to access different data sources with a unified interface, Microsoft's. NET provides us with ADO. net, we use ADO. net can easily access different databases produced by different manufacturers, ADO. net also provides a set of interfaces for later user-defined data providers. As long as we implement it ourselves, we can access our own data sources in the same way, we can access our XML data sources, text data sources, binary data sources, and WebService data sources through encapsulation. For application programmers, a small number of people may pay attention to the specific implementation details of the background; for new students, most of their knowledge has not yet been converted into subjective thinking about technology. They may be a bit unfamiliar with data providers, so we try to simplify complicated things as much as possible, programmers who do not need to access the Code In the background do not need to contact and reduce their thinking time.
Today, I want to introduce the WebService data provider, which is based on ADO. net, why do I have such an idea to write this provision program? It mainly comes from the problems that enterprises encounter when using our distributed system for a period of time, because our distributed system uses. netremoting implements port 8085 and adopts the TCP protocol. When deploying a project for an enterprise, the network structure of the enterprise is complicated, in addition, we do not know the network structure of the enterprise, so we have increased the maintenance workload for a large number of programs and brought a lot of maintenance time overhead to the Enterprise. netremoting uses the Windows service as the host and is deployed on the application server. It processes client TCP requests through the port ing of the vro. Few enterprises have a simple network structure and do not have complex security defense lines, because our company's projects are relatively large, they are all large and medium-sized enterprises. Their network coefficient is very high and firewall settings are basically not allowed to use the TCP protocol, in addition to common protocol ports such as HTTP 80 and FTP 21, the rest are all closed, so our system is difficult to deploy and use, but this problem was solved later, set. netremoting is deployed on IIS, and port 80 is also used. the netremoting sub-system handles the processing. However, after a while, I feel that WebService can also be implemented well, so I wrote it out and shared it with you. Some people may think that WebService is not. netremoting is highly efficient and may cause problems with large data volumes, as well as how to control the security authentication of WebService. If necessary, you can access the Internet and refer to relevant materials, for security authentication, you can add the corresponding session mechanism in the C/S system. I will not talk about it here. [Wang qingpei is copyrighted. Please give a signature for reprinting.]
1:
This figure shows the network topology of a general distributed system. Enterprises and servers are on the Intranet, and enterprises access our data sources through the WebService data provider;
2:
A basic prototype has been implemented below, at Hz. dataprovider. in the webservicedbmanager server project, you can implement many data sources. You can set up an ORM between the WebService and the database server to implement loose Data Access and switch database types at will. In this way, data is isolated layer by layer, it is also a good development method. [Wang qingpei is copyrighted. Please give a signature for reprinting]
3:
The provider obtains the datareader object. The front-end is completely developed just as we used to be familiar with. For programmers who have just developed the datareader, it is also a free solution and does not need to pay attention to complicated background implementations, you only need to follow the consistent method of development;
4:
5:
Figure 5 shows the server-side implementation code, which is the code used to connect to the database server. It executes the SQL passed by the client and returns the results returned by the database to the client;
Source code: Hz. webserviceprovider data provider (for learning reference only) [Wang qingpei All Rights Reserved. for reprinting, please sign it]