public static LogEntry For(AddReferencesRequest request) { LogEntry entry = new LogEntry("AddReferencesRequest"); entry.Add("RequestHeader", For(request.RequestHeader)); entry.Add("ReferencesToAdd", For(request.ReferencesToAdd)); return(entry); }
public async Task AddReferencesAsync() { var response = new AddReferencesResponse(); var request = new AddReferencesRequest(); var channel = new TestRequestChannel(response); var ret = await channel.AddReferencesAsync(request); ret .Should().BeSameAs(response); channel.Request .Should().BeSameAs(request); }
/// <summary> /// Adds one or more References to one or more Nodes. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="AddReferencesRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="AddReferencesResponse"/>.</returns> public static async Task <AddReferencesResponse> AddReferencesAsync(this IRequestChannel channel, AddReferencesRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((AddReferencesResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Begins an asynchronous invocation of the AddReferences service. /// </summary> public IAsyncResult BeginAddReferences( RequestHeader requestHeader, AddReferencesItemCollection referencesToAdd, AsyncCallback callback, object asyncState) { AddReferencesRequest request = new AddReferencesRequest(); request.RequestHeader = requestHeader; request.ReferencesToAdd = referencesToAdd; UpdateRequestHeader(request, requestHeader == null, "AddReferences"); if (UseTransportChannel) { return TransportChannel.BeginSendRequest(request, callback, asyncState); } return InnerChannel.BeginAddReferences(new AddReferencesMessage(request), callback, asyncState); }
/// <summary> /// Invokes the AddReferences service. /// </summary> public virtual ResponseHeader AddReferences( RequestHeader requestHeader, AddReferencesItemCollection referencesToAdd, out StatusCodeCollection results, out DiagnosticInfoCollection diagnosticInfos) { AddReferencesRequest request = new AddReferencesRequest(); AddReferencesResponse response = null; request.RequestHeader = requestHeader; request.ReferencesToAdd = referencesToAdd; UpdateRequestHeader(request, requestHeader == null, "AddReferences"); try { if (UseTransportChannel) { IServiceResponse genericResponse = TransportChannel.SendRequest(request); if (genericResponse == null) { throw new ServiceResultException(StatusCodes.BadUnknownResponse); } ValidateResponse(genericResponse.ResponseHeader); response = (AddReferencesResponse)genericResponse; } else { AddReferencesResponseMessage responseMessage = InnerChannel.AddReferences(new AddReferencesMessage(request)); if (responseMessage == null || responseMessage.AddReferencesResponse == null) { throw new ServiceResultException(StatusCodes.BadUnknownResponse); } response = responseMessage.AddReferencesResponse; ValidateResponse(response.ResponseHeader); } results = response.Results; diagnosticInfos = response.DiagnosticInfos; } finally { RequestCompleted(request, response, "AddReferences"); } return response.ResponseHeader; }
/// <summary> /// Initializes the message with the body. /// </summary> public AddReferencesMessage(AddReferencesRequest AddReferencesRequest) { this.AddReferencesRequest = AddReferencesRequest; }