public override DirectoryResponse SendRequest(DirectoryRequest request) { if (request == null) throw new ArgumentNullException("request"); DsmlRequestDocument doc = new DsmlRequestDocument(); doc.Add(request); DsmlResponseDocument response = SendRequestHelper(doc.ToXml().InnerXml); if (response.Count == 0) throw new DsmlInvalidDocumentException(Res.GetString(Res.MissingResponse)); DirectoryResponse result = response[0]; if (result is DsmlErrorResponse) { // need to throw ErrorResponseException ErrorResponseException e = new ErrorResponseException((DsmlErrorResponse)result); throw e; } else { ResultCode error = result.ResultCode; if (error == ResultCode.Success || error == ResultCode.CompareFalse || error == ResultCode.CompareTrue || error == ResultCode.Referral || error == ResultCode.ReferralV2) return result; else { throw new DirectoryOperationException(result, OperationErrorMappings.MapResultCode((int)error)); } } }
public override DirectoryResponse SendRequest(DirectoryRequest request) { if (request == null) { throw new ArgumentNullException("request"); } DsmlRequestDocument document = new DsmlRequestDocument(); document.Add(request); DsmlResponseDocument document2 = this.SendRequestHelper(document.ToXml().InnerXml); if (document2.Count == 0) { throw new DsmlInvalidDocumentException(System.DirectoryServices.Protocols.Res.GetString("MissingResponse")); } DirectoryResponse response = document2[0]; if (response is DsmlErrorResponse) { ErrorResponseException exception = new ErrorResponseException((DsmlErrorResponse) response); throw exception; } ResultCode resultCode = response.ResultCode; if (((resultCode != ResultCode.Success) && (resultCode != ResultCode.CompareFalse)) && (((resultCode != ResultCode.CompareTrue) && (resultCode != ResultCode.Referral)) && (resultCode != ResultCode.ReferralV2))) { throw new DirectoryOperationException(response, OperationErrorMappings.MapResultCode((int) resultCode)); } return response; }
public override DirectoryResponse SendRequest(DirectoryRequest request) { if (request != null) { DsmlRequestDocument dsmlRequestDocuments = new DsmlRequestDocument(); dsmlRequestDocuments.Add(request); DsmlResponseDocument dsmlResponseDocuments = this.SendRequestHelper(dsmlRequestDocuments.ToXml().InnerXml); if (dsmlResponseDocuments.Count != 0) { DirectoryResponse item = dsmlResponseDocuments[0]; if (item as DsmlErrorResponse == null) { ResultCode resultCode = item.ResultCode; if (resultCode == ResultCode.Success || resultCode == ResultCode.CompareFalse || resultCode == ResultCode.CompareTrue || resultCode == ResultCode.Referral || resultCode == ResultCode.ReferralV2) { return item; } else { throw new DirectoryOperationException(item, OperationErrorMappings.MapResultCode((int)resultCode)); } } else { ErrorResponseException errorResponseException = new ErrorResponseException((DsmlErrorResponse)item); throw errorResponseException; } } else { throw new DsmlInvalidDocumentException(Res.GetString("MissingResponse")); } } else { throw new ArgumentNullException("request"); } }