private static DispatchTable createOperations(MethodInfo[] ops) { Contract.Ensures(Contract.Result <DispatchTable>().IdToOperation.Count == Contract.Result <DispatchTable>().TokenToOperation.Count); var operations = new DispatchTable(); for (int orderNumber = 0; orderNumber < ops.Length; orderNumber++) { var methodInfo = ops[orderNumber]; var identifier = createIdentifier(methodInfo, orderNumber); OperationDispatchBase operation = create(methodInfo, identifier); operations.IdToOperation[identifier] = operation; operations.TokenToOperation[methodInfo.MetadataToken] = operation; } return(operations); }
//TODO: split RpcProxyRouter and RpcCallbackProxy public ClientRuntime(string address, ServiceEndpoint endpoint, bool callback = false, InstanceContext context = null, Guid customUuid = default(Guid), Type generatedProxyType = null) { _endpoint = endpoint; _binding = endpoint._binding; _serializer = _binding.Serializer; _typeOfService = endpoint._contractType; _context = context; if (_context != null && _context._useSynchronizationContext) { _syncContext = SynchronizationContext.Current; } _generatedProxyType = generatedProxyType; _address = address; _operations = DispatchTableFactory.GetOperations(_typeOfService); _uuid = EndpointMapper.CreateUuid(_address, _typeOfService); if (customUuid != Guid.Empty) // callback proxy { _uuid = customUuid; } var serviceContract = AttributesReader.GetServiceContract(_typeOfService); //TODO: null check only for duplex callback, really should always be here if (serviceContract != null && serviceContract.SessionMode == SessionMode.Required) { _session = Guid.NewGuid().ToString(); } //TODO: allow to be initialized with pregenerated proxy var realProxy = new RpcRealProxy(_typeOfService, this, _endpoint, _encoder); _remote = realProxy.GetTransparentProxy(); _client = RpcRequestReplyChannelFactory.CreateClient(_binding, _uuid, _address); foreach (var behavior in _endpoint.Behaviors) { behavior.ApplyClientBehavior(_endpoint, this); } }
private static DispatchTable createOperations(MethodInfo[] ops) { Contract.Ensures(Contract.Result<DispatchTable>().IdToOperation.Count == Contract.Result<DispatchTable>().TokenToOperation.Count); var operations = new DispatchTable(); for (int orderNumber = 0; orderNumber < ops.Length; orderNumber++) { var methodInfo = ops[orderNumber]; var identifier = createIdentifier(methodInfo, orderNumber); OperationDispatchBase operation = create(methodInfo, identifier); operations.IdToOperation[identifier] = operation; operations.TokenToOperation[methodInfo.MetadataToken] = operation; } return operations; }
protected EndpointDispatcher(object singletonService, ServiceEndpoint endpoint) { _endpoint = endpoint; _singletonService = singletonService; _operations = DispatchTableFactory.GetOperations(endpoint._contractType); }
protected EndpointDispatcher(object singletonService, ServiceEndpoint endpoint) { _endpoint = endpoint; _singletonService = singletonService; _operations = DispatchTableFactory.GetOperations(endpoint._contractType); }