コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 // 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);
     }
 }
コード例 #4
0
        // 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);
            }
        }
コード例 #5
0
 void InitWithFailingService()
 {
     service = new FailingServiceImplementation();
     Init();
 }
コード例 #6
0
 void InitWithService()
 {
     service = new ServiceImplmentation();
     Init();
 }
コード例 #7
0
 /// <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;
 }
コード例 #10
0
 /// <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;
 }
コード例 #11
0
 void InitWithService()
 {
     service = new ServiceImplmentation();
     Init();
 }
コード例 #12
0
 void InitWithFailingService()
 {
     service = new FailingServiceImplementation();
     Init();
 }
コード例 #13
0
 public ClassWithMethodCallingMethodReturningBoolean(IServiceInterface service)
 {
     _service = service;
 }
コード例 #14
0
 public HomeController(IModelFactory modelFactory, IServiceInterface serviceInterface)
 {
     this.modelFactory     = modelFactory;
     this.serviceInterface = serviceInterface;
 }
コード例 #15
0
 public ServiceDecorator1(IServiceInterface wrapped)
 {
     this.wrapped = wrapped;
 }
コード例 #16
0
 public ServiceDecorator2(IServiceInterface wrapped, int aParam)
 {
     this.wrapped = wrapped;
     this.aParam  = aParam;
 }