示例#1
0
        /// <summary>
        /// Initializes the <see cref="CorrelatingRemotingMessageHandler"/> object. It wraps the given actor service for all the core
        /// operations for servicing the request.
        /// </summary>
        /// <param name="actorService">The actor service whose remoting messages this handler should handle.</param>
        public CorrelatingRemotingMessageHandler(ActorService actorService, bool switchOperationContext)
        {
            InitializeCommonFields();
            _innerHandler           = new ActorServiceRemotingDispatcher(actorService);
            _isActorService         = true;
            _switchOperationContext = switchOperationContext;

            // Populate our method name provider with methods from the ActorService interfaces, and the Actor interfaces
            _methodNameProvider.AddMethodsForProxyOrService(actorService.GetType().GetInterfaces(), typeof(IService));
            _methodNameProvider.AddMethodsForProxyOrService(actorService.ActorTypeInformation.InterfaceTypes, typeof(IActor));
        }
示例#2
0
        public TServiceInterface CreateServiceProxy <TServiceInterface>(Uri serviceUri, ServicePartitionKey partitionKey = null, TargetReplicaSelector targetReplicaSelector = TargetReplicaSelector.Default, string listenerName = null) where TServiceInterface : IService
        {
            TServiceInterface proxy =
                _serviceProxyFactory.CreateServiceProxy <TServiceInterface>(serviceUri, partitionKey, targetReplicaSelector,
                                                                            listenerName);

            _methodNameProvider.AddMethodsForProxyOrService(proxy.GetType().GetInterfaces(), typeof(IService));

            return(proxy);
        }