Ejemplo n.º 1
0
        protected override void InitializeConnection(IRemoteConnection connection)
        {
            var remoteExecutor       = connection.RemoteExecutor;
            var twoWayCallback       = Aspects.WithTimeMeasure(remoteExecutor.Create <IClientCallback>(ReturnPolicy.TwoWay), ConsoleColor.DarkCyan);
            var oneWayCallback       = Aspects.WithTimeMeasure(remoteExecutor.Create <IClientCallback>(ReturnPolicy.OneWay), ConsoleColor.DarkCyan);
            var longRunningOperation = Aspects.WithTimeMeasure <ILongRunningOperation>(new LongRunningOperation(twoWayCallback, oneWayCallback));

            connection.OperationDispatcher.RegisterHandler(longRunningOperation);
        }
Ejemplo n.º 2
0
        protected override void InitializeConnection(IRemoteConnection connection)
        {
            var userContext = new ClientContext();

            _sharedContext.AddClient(connection, userContext);

            var registrationService = Aspects.WithTimeMeasure <IRegistrationService>(new RegistrationService(userContext, _broadcastService));
            var userInfoService     = Aspects.WithTimeMeasure <IUserInfoService>(new UserInfoService(_sharedContext, userContext));

            connection.OperationDispatcher
            .RegisterHandler(registrationService)
            .RegisterHandler(userInfoService);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Configurator.Configure();
            IOperationDispatcher callbackDispatcher = new OperationDispatcher();

            callbackDispatcher.RegisterHandler(Aspects.WithTimeMeasure <IClientCallback>(new ClientCallback(), ConsoleColor.DarkCyan));

            using (var client = new ClientConnection("net://localhost:3134/CallbackDispatcher", callbackDispatcher))
            {
                client.Open();

                var longRunningOperation = Aspects.WithTimeMeasure(client.RemoteExecutor.Create <ILongRunningOperation>(ReturnPolicy.OneWay));

                longRunningOperation.Repeat("a", 3);
                longRunningOperation.RepeatWithCallback("b", 3);
                longRunningOperation.RepeatWithOneWayCallback("c", 3);

                Console.WriteLine("Done. Please wait few seconds for callbacks and press enter to exit.");
                Console.ReadLine();
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Configurator.Configure();
            IOperationDispatcher callbackDispatcher = new OperationDispatcher();
            IBroadcastService    broadcastService   = Aspects.WithTimeMeasure <IBroadcastService>(new BroadcastService(), ConsoleColor.DarkCyan);

            callbackDispatcher.RegisterHandler(broadcastService);

            using (var client = new ClientConnection("net://localhost:3135/BroadcastServices", callbackDispatcher))
            {
                client.Open();

                var userInfoService     = Aspects.WithTimeMeasure(client.RemoteExecutor.Create <IUserInfoService>());
                var registrationService = Aspects.WithTimeMeasure(client.RemoteExecutor.Create <IRegistrationService>());

                GetUsers(userInfoService);
                RegisterUser(registrationService);
                GetUsers(userInfoService);

                Console.WriteLine("Done. Press enter to exit.");
                Console.ReadLine();
            }
        }
Ejemplo n.º 5
0
 public Host(string uri)
     : base(uri, new ServerConfig())
 {
     _broadcastService = Aspects.WithTimeMeasure(BroadcastRemoteExecutor.Create <IBroadcastService>(), ConsoleColor.DarkCyan);
     ConnectionClosed += OnConnectionClose;
 }