internal void InvalidateRuntime() { lock (ThisLock) { _shared.ThrowIfImmutable(); _runtime = null; } }
internal void InvalidateRuntime() { lock (this.ThisLock) { this.shared.ThrowIfImmutable(); this.runtime = null; } }
internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent) { if (operation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); } if (parent == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent"); } _parent = parent; _formatter = operation.Formatter; _isInitiating = operation.IsInitiating; _isOneWay = operation.IsOneWay; _isTerminating = operation.IsTerminating; _isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled; _name = operation.Name; _parameterInspectors = EmptyArray <IParameterInspector> .ToArray(operation.ParameterInspectors); _faultFormatter = operation.FaultFormatter; _serializeRequest = operation.SerializeRequest; _deserializeReply = operation.DeserializeReply; _action = operation.Action; _replyAction = operation.ReplyAction; _beginMethod = operation.BeginMethod; _syncMethod = operation.SyncMethod; _taskMethod = operation.TaskMethod; this.TaskTResult = operation.TaskTResult; if (_beginMethod != null) { _inParams = ServiceReflector.GetInputParameters(_beginMethod, true); if (_syncMethod != null) { _outParams = ServiceReflector.GetOutputParameters(_syncMethod, false); } else { _outParams = Array.Empty <ParameterInfo>(); } _endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true); _returnParam = operation.EndMethod.ReturnParameter; } else if (_syncMethod != null) { _inParams = ServiceReflector.GetInputParameters(_syncMethod, false); _outParams = ServiceReflector.GetOutputParameters(_syncMethod, false); _returnParam = _syncMethod.ReturnParameter; } if (_formatter == null && (_serializeRequest || _deserializeReply)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.ClientRuntimeRequiresFormatter0, _name))); } }
internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent) { if (operation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); } if (parent == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent"); } this.parent = parent; this.formatter = operation.Formatter; this.isInitiating = operation.IsInitiating; this.isOneWay = operation.IsOneWay; this.isTerminating = operation.IsTerminating; this.isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled; this.name = operation.Name; this.parameterInspectors = EmptyArray <IParameterInspector> .ToArray(operation.ParameterInspectors); this.faultFormatter = operation.FaultFormatter; this.serializeRequest = operation.SerializeRequest; this.deserializeReply = operation.DeserializeReply; this.action = operation.Action; this.replyAction = operation.ReplyAction; this.beginMethod = operation.BeginMethod; this.syncMethod = operation.SyncMethod; this.taskMethod = operation.TaskMethod; this.TaskTResult = operation.TaskTResult; if (this.beginMethod != null) { this.inParams = ServiceReflector.GetInputParameters(this.beginMethod, true); if (this.syncMethod != null) { this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false); } else { this.outParams = NoParams; } this.endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true); this.returnParam = operation.EndMethod.ReturnParameter; } else if (this.syncMethod != null) { this.inParams = ServiceReflector.GetInputParameters(this.syncMethod, false); this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false); this.returnParam = this.syncMethod.ReturnParameter; } if (this.formatter == null && (serializeRequest || deserializeReply)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ClientRuntimeRequiresFormatter0, this.name))); } }
internal ImmutableClientRuntime GetRuntime() { lock (this.ThisLock) { if (this.runtime == null) { this.runtime = new ImmutableClientRuntime(this); } return(this.runtime); } }
internal ServiceChannelProxy(System.Type interfaceType, System.Type proxiedType, MessageDirection direction, ServiceChannel serviceChannel) : base(proxiedType) { if (!MessageDirectionHelper.IsDefined(direction)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("direction")); } this.interfaceType = interfaceType; this.proxiedType = proxiedType; this.serviceChannel = serviceChannel; this.proxyRuntime = serviceChannel.ClientRuntime.GetRuntime(); this.methodDataCache = new MethodDataCache(); this.objectWrapper = new MbrObject(this, proxiedType); }
internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent) { if (operation == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); if (parent == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent"); _parent = parent; _formatter = operation.Formatter; _isInitiating = operation.IsInitiating; _isOneWay = operation.IsOneWay; _isTerminating = operation.IsTerminating; _isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled; _name = operation.Name; _parameterInspectors = EmptyArray<IParameterInspector>.ToArray(operation.ParameterInspectors); _faultFormatter = operation.FaultFormatter; _serializeRequest = operation.SerializeRequest; _deserializeReply = operation.DeserializeReply; _action = operation.Action; _replyAction = operation.ReplyAction; _beginMethod = operation.BeginMethod; _syncMethod = operation.SyncMethod; _taskMethod = operation.TaskMethod; this.TaskTResult = operation.TaskTResult; if (_beginMethod != null) { _inParams = ServiceReflector.GetInputParameters(_beginMethod, true); if (_syncMethod != null) { _outParams = ServiceReflector.GetOutputParameters(_syncMethod, false); } else { _outParams = Array.Empty<ParameterInfo>(); } _endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true); _returnParam = operation.EndMethod.ReturnParameter; } else if (_syncMethod != null) { _inParams = ServiceReflector.GetInputParameters(_syncMethod, false); _outParams = ServiceReflector.GetOutputParameters(_syncMethod, false); _returnParam = _syncMethod.ReturnParameter; } if (_formatter == null && (_serializeRequest || _deserializeReply)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.ClientRuntimeRequiresFormatter0, _name))); } }
internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent) { if (operation == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); if (parent == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent"); this.parent = parent; this.formatter = operation.Formatter; this.isInitiating = operation.IsInitiating; this.isOneWay = operation.IsOneWay; this.isTerminating = operation.IsTerminating; this.isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled; this.name = operation.Name; this.parameterInspectors = EmptyArray<IParameterInspector>.ToArray(operation.ParameterInspectors); this.faultFormatter = operation.FaultFormatter; this.serializeRequest = operation.SerializeRequest; this.deserializeReply = operation.DeserializeReply; this.action = operation.Action; this.replyAction = operation.ReplyAction; this.beginMethod = operation.BeginMethod; this.syncMethod = operation.SyncMethod; this.taskMethod = operation.TaskMethod; this.TaskTResult = operation.TaskTResult; if (this.beginMethod != null) { this.inParams = ServiceReflector.GetInputParameters(this.beginMethod, true); if (this.syncMethod != null) { this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false); } else { this.outParams = NoParams; } this.endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true); this.returnParam = operation.EndMethod.ReturnParameter; } else if (this.syncMethod != null) { this.inParams = ServiceReflector.GetInputParameters(this.syncMethod, false); this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false); this.returnParam = this.syncMethod.ReturnParameter; } if (this.formatter == null && (serializeRequest || deserializeReply)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ClientRuntimeRequiresFormatter0, this.name))); } }
protected ChannelBase(ClientBase <T> client) { if (client.Endpoint.Address == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SRServiceModel.SFxChannelFactoryEndpointAddressUri)); } ChannelFactory <T> cf = client._channelFactory; cf.EnsureOpened(); // to prevent the NullReferenceException that is thrown if the ChannelFactory is not open when cf.ServiceChannelFactory is accessed. _channel = cf.ServiceChannelFactory.CreateServiceChannel(client.Endpoint.Address, client.Endpoint.Address.Uri); _channel.InstanceContext = cf.CallbackInstance; _runtime = _channel.ClientRuntime.GetRuntime(); }