public void AfterReceiveReply(ref Message reply, object correlationState) { if (reply.IsFault) { MessageBuffer buffer = reply.CreateBufferedCopy(int.MaxValue); Message copy = buffer.CreateMessage(); reply = buffer.CreateMessage(); object faultDetail = ClientMessageInspectorHelper.ReadFaultDetail(copy); Exception exception = faultDetail as Exception; if (exception != null && exception is EntityValidationException) { throw exception; } } }
public void AfterReceiveReply(ref Message reply, object correlationState) { if (reply.IsFault) { MessageBuffer buffer = reply.CreateBufferedCopy(int.MaxValue); Message copy = buffer.CreateMessage(); reply = buffer.CreateMessage(); object faultDetail = ClientMessageInspectorHelper.ReadFaultDetail(copy); Exception exception = faultDetail as Exception; if (exception != null && !(exception is OperationException) && !(exception is EntityValidationException)) { throw new TechnicalException( string.Format("{0}: {1}", exception.GetType().FullName, exception.Message), exception); } } }