Link to home
Start Free TrialLog in
Avatar of jfz2004
jfz2004

asked on

Need help in Microsoft's Remote Object application

Hi,

I am working on a sample application of Remote Object. It works
if I don't have parameters passed in calling the object, i.e., client
can talk to the server. But how to pass a parameter to server's
object? Below is part of the source code in the server:

public static int Main(string [] args) {

.....

RemotingConfiguration.RegisterWellKnownServiceType(

typeof(SampleObject), "mysample", WellKnownObjectMode.SingleCall );

.....

Basically I want to pass args into SampleObject, how do I do it?

Thanks for any help.

Jennifer

}
Avatar of sumix
sumix

With server activation you can only use default constructors (no parameters) for remote objects. You can use methods of the remote object to pass values to it.

If you have constructors that receive parameters you may use client activation (create instances of the remote object with Activator.CreateInstance instead of RegisterWellKnownServiceType) but you should be aware of the details of this approach

See http://msdn2.microsoft.com/en-us/library/y0h540a7(VS.80).aspx 
Avatar of jfz2004

ASKER

Thanks,

How to use methods of the remote object to pass value?

Below is the source code for my object:

public class SampleObject : MarshalByRefObject
{
public static DataTable vTable = new DataTable("vTable");

public string getVTable(string date, int id)
{
}
}

ASKER CERTIFIED SOLUTION
Avatar of sumix
sumix

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfz2004

ASKER

This is similar to what I am doing. Thanks.
I will try it over the weekend.
Jennifer