internal DispatchOperationRuntime(DispatchOperation operation, ImmutableDispatchRuntime parent) { if (operation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); } if (parent == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent"); } if (operation.Invoker == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("RuntimeRequiresInvoker0"))); } this.disposeParameters = operation.AutoDisposeParameters && !operation.HasNoDisposableParameters; this.parent = parent; this.callContextInitializers = EmptyArray <ICallContextInitializer> .ToArray(operation.CallContextInitializers); this.inspectors = EmptyArray <IParameterInspector> .ToArray(operation.ParameterInspectors); this.faultFormatter = operation.FaultFormatter; this.impersonation = operation.Impersonation; this.deserializeRequest = operation.DeserializeRequest; this.serializeReply = operation.SerializeReply; this.formatter = operation.Formatter; this.invoker = operation.Invoker; try { this.isSynchronous = operation.Invoker.IsSynchronous; } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(exception); } this.isTerminating = operation.IsTerminating; this.action = operation.Action; this.name = operation.Name; this.releaseInstanceAfterCall = operation.ReleaseInstanceAfterCall; this.releaseInstanceBeforeCall = operation.ReleaseInstanceBeforeCall; this.replyAction = operation.ReplyAction; this.isOneWay = operation.IsOneWay; this.transactionAutoComplete = operation.TransactionAutoComplete; this.transactionRequired = operation.TransactionRequired; this.receiveContextAcknowledgementMode = operation.ReceiveContextAcknowledgementMode; this.bufferedReceiveEnabled = operation.BufferedReceiveEnabled; this.isInsideTransactedReceiveScope = operation.IsInsideTransactedReceiveScope; if ((this.formatter == null) && (this.deserializeRequest || this.serializeReply)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("DispatchRuntimeRequiresFormatter0", new object[] { this.name }))); } if ((operation.Parent.InstanceProvider == null) && (operation.Parent.Type != null)) { SyncMethodInvoker invoker = this.invoker as SyncMethodInvoker; if (invoker != null) { this.ValidateInstanceType(operation.Parent.Type, invoker.Method); } AsyncMethodInvoker invoker2 = this.invoker as AsyncMethodInvoker; if (invoker2 != null) { this.ValidateInstanceType(operation.Parent.Type, invoker2.BeginMethod); this.ValidateInstanceType(operation.Parent.Type, invoker2.EndMethod); } } }
internal DispatchOperationRuntime(DispatchOperation operation, ImmutableDispatchRuntime parent) { if (operation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); } if (parent == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent"); } if (operation.Invoker == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("RuntimeRequiresInvoker0"))); } this.disposeParameters = operation.AutoDisposeParameters && !operation.HasNoDisposableParameters; this.parent = parent; this.callContextInitializers = EmptyArray<ICallContextInitializer>.ToArray(operation.CallContextInitializers); this.inspectors = EmptyArray<IParameterInspector>.ToArray(operation.ParameterInspectors); this.faultFormatter = operation.FaultFormatter; this.impersonation = operation.Impersonation; this.deserializeRequest = operation.DeserializeRequest; this.serializeReply = operation.SerializeReply; this.formatter = operation.Formatter; this.invoker = operation.Invoker; try { this.isSynchronous = operation.Invoker.IsSynchronous; } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(exception); } this.isTerminating = operation.IsTerminating; this.action = operation.Action; this.name = operation.Name; this.releaseInstanceAfterCall = operation.ReleaseInstanceAfterCall; this.releaseInstanceBeforeCall = operation.ReleaseInstanceBeforeCall; this.replyAction = operation.ReplyAction; this.isOneWay = operation.IsOneWay; this.transactionAutoComplete = operation.TransactionAutoComplete; this.transactionRequired = operation.TransactionRequired; this.receiveContextAcknowledgementMode = operation.ReceiveContextAcknowledgementMode; this.bufferedReceiveEnabled = operation.BufferedReceiveEnabled; this.isInsideTransactedReceiveScope = operation.IsInsideTransactedReceiveScope; if ((this.formatter == null) && (this.deserializeRequest || this.serializeReply)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("DispatchRuntimeRequiresFormatter0", new object[] { this.name }))); } if ((operation.Parent.InstanceProvider == null) && (operation.Parent.Type != null)) { SyncMethodInvoker invoker = this.invoker as SyncMethodInvoker; if (invoker != null) { this.ValidateInstanceType(operation.Parent.Type, invoker.Method); } AsyncMethodInvoker invoker2 = this.invoker as AsyncMethodInvoker; if (invoker2 != null) { this.ValidateInstanceType(operation.Parent.Type, invoker2.BeginMethod); this.ValidateInstanceType(operation.Parent.Type, invoker2.EndMethod); } } }