/// <summary> // Activate the remote interface IServiceInterface /// </summary> /// <returns>true if activated else false</returns> public virtual bool ActivateTheInterface() { bool activated = false; try { WellKnownServiceTypeEntry WKSTE = new WellKnownServiceTypeEntry(typeof(IServiceInterface), StateServerConfig.RestServicesUrl, WellKnownObjectMode.SingleCall); if (RemotingConfiguration.ApplicationName == null) { RemotingConfiguration.ApplicationName = "RestService"; RemotingConfiguration.RegisterWellKnownServiceType(WKSTE); } callToService = (IServiceInterface)Activator.GetObject(typeof(IServiceInterface), WKSTE.ObjectUri); if (callToService != null) { activated = true; } } catch (System.Exception ex) { StateServerAssert.Assert(ex); } return(activated); }
public void SingletoneByInterface_GetTwice_SameInstances() { IServiceProvider scopedProvider = _provider.CreateScope().ServiceProvider; IServiceInterface singletone1 = _provider.GetService <IServiceInterface>(); IServiceInterface singletone2 = _provider.GetService <IServiceInterface>(); IServiceInterface singletone3 = scopedProvider.GetService <IServiceInterface>(); Assert.AreEqual(singletone1, singletone2); Assert.AreEqual(singletone2, singletone3); }
// Connect to the service public void connect() { var binding = new NetTcpBinding(); var endpoint = new EndpointAddress("net.tcp://localhost:9000/IGameService"); var channelFactory = new DuplexChannelFactory<IServiceInterface>(callback, binding, endpoint); try { connection = channelFactory.CreateChannel(); getCommObj().Open(); } catch (Exception ex) { Trace.WriteLine("Exception on connecting to service: " + ex); } }
// Connect to the service public void connect() { var binding = new NetTcpBinding(); var endpoint = new EndpointAddress("net.tcp://localhost:9000/IGameService"); var channelFactory = new DuplexChannelFactory <IServiceInterface>(callback, binding, endpoint); try { connection = channelFactory.CreateChannel(); getCommObj().Open(); } catch (Exception ex) { Trace.WriteLine("Exception on connecting to service: " + ex); } }
void InitWithFailingService() { service = new FailingServiceImplementation(); Init(); }
void InitWithService() { service = new ServiceImplmentation(); Init(); }
/// <summary> /// The dependencies are injected. /// </summary> /// <param name="asyncMethodCaller">Use TestAsyncMethodCaller for tests, AsyncMethodCaller in production.</param> /// <param name="service">Inject the service for easier faking and faster tests.</param> public ViewModel(AsyncMethodCaller asyncMethodCaller, IServiceInterface service) { this.asyncMethodCaller = asyncMethodCaller; this.service = service; }
public ClassWithMethodCallingMethodReturningReferenceType(IServiceInterface service) { _service = service; }
public ClassUsingMethodOfInjectedService(IServiceInterface service) { _service = service; }
public ClassWithMethodCallingMethodReturningBoolean(IServiceInterface service) { _service = service; }
public HomeController(IModelFactory modelFactory, IServiceInterface serviceInterface) { this.modelFactory = modelFactory; this.serviceInterface = serviceInterface; }
public ServiceDecorator1(IServiceInterface wrapped) { this.wrapped = wrapped; }
public ServiceDecorator2(IServiceInterface wrapped, int aParam) { this.wrapped = wrapped; this.aParam = aParam; }