Practical .NET Data Access Layer - 14

zhaozj2021-02-16  52

Code 12: Remoting Call using Data Access Logic - 2, Remoting Access

Class Customerdal_orm: Mydal

{

/ / Please note: This delegate method is restricted to Private Access Permissions

Private arraylist getAllcustomers_Remoting_Delegate ()

{

ArrayList al = NULL;

RemoteCustomer Remote = (RemoteCustomer) Activator.getObject (

TypeOf (RemotingClass.Remotecustomer),

Helper.GetApplicationSetting ("remoteurl"));

IF (remote == null)

Throw New Exception ("Could Not Locate Server!");

Else

{

Al = Remote.GetAllCustomers ();

}

Return Al;

}

}

The above two codes should not be difficult to understand, if we combine the DAF in front, we will

Can draw a schematic diagram of call:

The above code 11, 12 (1 to 6 above) is merely the client behavior, and

At the server side, we have to do such two things:

(1) Establish a Host program (if you use HTTP SOAP to simulate Webserve, because the recitaling behavior can directly host Under ASP.NET, it can be saved to this step), mainly used to register service at the specified port (listen Friends said, someone in online remoting host manager, interesting comrades can go to CodeProjects

(2) Establish a service class inherited from MarshalByrefObject, which will be used by the HOST program in step 1 for registration operations;

Next paragraph: http://www.9cbs.net/develop/read_article.asp? Id = 27558

转载请注明原文地址:https://www.9cbs.com/read-24094.html

New Post(0)