|
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
using Interfaces;
namespace ClientTests
{
public static class RemotingHelper
{
public static void LoadConfiguration(string configFile)
{
RemotingConfiguration.Configure(configFile, false);
}
public static void UnloadConfiguration()
{
IChannel[] channels=ChannelServices.RegisteredChannels;
foreach (IChannel channel in channels)
{
ChannelServices.UnregisterChannel(channel);
}
}
public static ITest CreatePerCallTestObject()
{
MarshalByRefObject objRef = (MarshalByRefObject)RemotingServices.Connect(typeof(ITest), "http://localhost:65100/SingleCallTestService");
ITest test = objRef as ITest;
return test;
}
public static ITest CreateSingletonTestObject()
{
MarshalByRefObject objRef = (MarshalByRefObject)RemotingServices.Connect(typeof(ITest), "http://localhost:65100/SingletonTestService");
ITest test = objRef as ITest;
return test;
}
public static IFactory CreateFactoryObject()
{
MarshalByRefObject objRef = (MarshalByRefObject)RemotingServices.Connect(typeof(IFactory), "http://localhost:65100/FactoryService");
IFactory factory = objRef as IFactory;
return factory;
}
public static IAsyncManagement CreateAsyncManagement()
{
MarshalByRefObject objRef = (MarshalByRefObject)RemotingServices.Connect(typeof(IFactory), "http://localhost:65100/AsyncThreadService");
IAsyncManagement asyncMgr = objRef as IAsyncManagement;
return asyncMgr;
}
public static IComplexTest CreateComplexTest()
{
MarshalByRefObject objRef = (MarshalByRefObject)RemotingServices.Connect(typeof(IFactory), "http://localhost:65100/ComplexTestService");
IComplexTest compTest = objRef as IComplexTest;
return compTest;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here