/// <summary>
        /// This overload is meant to be used by partner teams from their External Access layer.
        /// </summary>
        internal RemoteServiceConnection <T> CreateConnection <T>(ServiceDescriptors descriptors, IRemoteServiceCallbackDispatcherProvider callbackDispatcherProvider, object?callbackTarget) where T : class
        {
            var descriptor         = descriptors.GetServiceDescriptor(typeof(T), Configuration);
            var callbackDispatcher = (descriptor.ClientInterface != null) ? callbackDispatcherProvider.GetDispatcher(typeof(T)) : null;

            return(new BrokeredServiceConnection <T>(
                       descriptor,
                       callbackTarget,
                       callbackDispatcher,
                       _serviceBrokerClient,
                       _assetStorage,
                       _errorReportingService,
                       _shutdownCancellationService));
        }
Exemplo n.º 2
0
        public BrokeredServiceConnection(
            object?callbackTarget,
            ServiceBrokerClient serviceBrokerClient,
            SolutionAssetStorage solutionAssetStorage,
            IErrorReportingService?errorReportingService,
            IRemoteHostClientShutdownCancellationService?shutdownCancellationService,
            bool isRemoteHost64Bit)
        {
            _serviceBrokerClient         = serviceBrokerClient;
            _solutionAssetStorage        = solutionAssetStorage;
            _errorReportingService       = errorReportingService;
            _shutdownCancellationService = shutdownCancellationService;

            _serviceDescriptor = ServiceDescriptors.GetServiceDescriptor(typeof(TService), isRemoteHost64Bit);
            _callbackHandle    = _serviceDescriptor.CallbackDispatcher?.CreateHandle(callbackTarget) ?? default;
        }
Exemplo n.º 3
0
            internal TService Create(
                IDuplexPipe pipe,
                IServiceProvider hostProvidedServices,
                ServiceActivationOptions serviceActivationOptions,
                IServiceBroker serviceBroker)
            {
                var descriptor       = ServiceDescriptors.GetServiceDescriptor(typeof(TService), isRemoteHost64Bit: IntPtr.Size == 8);
                var serverConnection = descriptor.ConstructRpcConnection(pipe);

                var args    = new ServiceConstructionArguments(hostProvidedServices, serviceBroker, new CancellationTokenSource());
                var service = CreateService(args, descriptor, serverConnection, serviceActivationOptions.ClientRpcTarget);

                serverConnection.AddLocalRpcTarget(service);
                serverConnection.StartListening();

                return(service);
            }
Exemplo n.º 4
0
        public BrokeredServiceConnection(
            object?callbackTarget,
            RemoteServiceCallbackDispatcherRegistry callbackDispatchers,
            ServiceBrokerClient serviceBrokerClient,
            SolutionAssetStorage solutionAssetStorage,
            IErrorReportingService?errorReportingService,
            IRemoteHostClientShutdownCancellationService?shutdownCancellationService,
            bool isRemoteHost64Bit)
        {
            _serviceBrokerClient         = serviceBrokerClient;
            _solutionAssetStorage        = solutionAssetStorage;
            _errorReportingService       = errorReportingService;
            _shutdownCancellationService = shutdownCancellationService;

            _serviceDescriptor = ServiceDescriptors.GetServiceDescriptor(typeof(TService), isRemoteHost64Bit);

            if (_serviceDescriptor.ClientInterface != null)
            {
                _callbackDispatcher = callbackDispatchers.GetDispatcher(typeof(TService));
                _callbackHandle     = _callbackDispatcher.CreateHandle(callbackTarget);
            }
        }