remoting client -> interface based question

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I have a question.. I am using remoting but on my client side I chose to use
an interface. As a result I was wondering if its still possible to place the
configuration details into a xml config file ?

I have not seen any examples of this does anyone know how I can do this ?
All I've seen are example such as below where an interface calling the
server as such. but I would like to not use this and instead call the config
file as its easily changed without the need to recompile

IRemotingExampleService resService
=(IRemotingExampleService)Activator.GetObject(

typeof(IRemotingExampleService),

"tcp://localhost:9988/RemotingExampleService");

Console.WriteLine("RESUME:\n"+ resService.GetFormattedResume());





Thanks

Tom
 
Instead of using the remoting config on the client side (which apart from setting up channel/formatter combinations other than the defaults is only really used for redirecting new for a type - this doesn't work for interfaces) why not use the appSettings section

<configuration>
<appSettings>
<add key="URL" value="tcp://localhost:9988/RemotingExampleService"/>
</appSettings>
</configuration>

Then your code can look like this

string url = ConfigurationSettings.AppSettings["URL"];
IRemotingExampleService resService =(IRemotingExampleService)Activator.GetObject( typeof(IRemotingExampleService), url);
Console.WriteLine("RESUME:\n"+ resService.GetFormattedResume());

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

I have a question.. I am using remoting but on my client side I chose to use
an interface. As a result I was wondering if its still possible to place the
configuration details into a xml config file ?

I have not seen any examples of this does anyone know how I can do this ?
All I've seen are example such as below where an interface calling the
server as such. but I would like to not use this and instead call the config
file as its easily changed without the need to recompile

IRemotingExampleService resService
=(IRemotingExampleService)Activator.GetObject(

typeof(IRemotingExampleService),

"tcp://localhost:9988/RemotingExampleService");

Console.WriteLine("RESUME:\n"+ resService.GetFormattedResume());





Thanks

Tom



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.770 / Virus Database: 517 - Release Date: 27/09/2004



[microsoft.public.dotnet.languages.csharp]
 
Back
Top