public ResponseExceptionInvoker(IOperationInvoker oldInvoker, OperationDescription operationDescription) : base(oldInvoker) { // save the return type for creating response messages this.returnType = operationDescription.GetReturnType(); if (this.returnType == null) { throw new InvalidOperationException("The operation '" + operationDescription.SyncMethod.DeclaringType.Name + "' does not define a return type."); } }
public override void Validate(OperationDescription operationDescription) { // validate that this attribute can be applied to the service behavior. Type returnType = operationDescription.GetReturnType(); if (!typeof(Response).IsAssignableFrom(returnType)) { throw new InvalidOperationException("'" + returnType.FullName + "' does not inherit from '" + typeof(Response).FullName + "'. ImplicitResponse behavior applied to '" + operationDescription.SyncMethod.DeclaringType.Name + "." + operationDescription.Name + "' requires the method return type inherit from '" + typeof(Response).FullName); } }