/// <summary> /// Initializes a new instance of the <see cref="RemoteSearchOperation"/> class. /// </summary> /// <param name="containerMetaInfo"> /// The container meta information. /// </param> /// <param name="recordIdentification"> /// The record identification. /// </param> /// <param name="linkRecordIdentification"> /// The link record identification. /// </param> /// <param name="linkId"> /// The link identifier. /// </param> /// <param name="handler"> /// The handler. /// </param> public RemoteSearchOperation( UPContainerMetaInfo containerMetaInfo, string recordIdentification, string linkRecordIdentification, int linkId, ISearchOperationHandler handler) { this.ContainerMetaInfo = containerMetaInfo; this.QueryParameters = new Dictionary <string, string>(); this.SearchOperationHandler = handler; this.QueryParameters["QueryDef"] = JsonConvert.SerializeObject(containerMetaInfo?.QueryToObject()); if (!string.IsNullOrEmpty(linkRecordIdentification)) { this.QueryParameters["LinkRecordIdentification"] = linkRecordIdentification; if (linkId >= 0) { this.QueryParameters["LinkId"] = $" {linkId}"; } } if (!string.IsNullOrEmpty(recordIdentification)) { this.RecordIdentification = recordIdentification; this.SkipLocalMerge = true; this.QueryParameters["RecordIdentification"] = recordIdentification; } if (containerMetaInfo?.MaxResults > 0) { this.QueryParameters["MaxResults"] = $" {containerMetaInfo.MaxResults}"; // it was {containerMetaInfo.MaxResults + 1}. I can't find the logic in this +1 here. } }
/// <summary> /// Adds the container meta information. /// </summary> /// <param name="containerMetaInfo"> /// The container meta information. /// </param> /// <param name="recordIdentification"> /// The record identification. /// </param> /// <param name="linkRecordIdentification"> /// The link record identification. /// </param> /// <param name="linkId"> /// The link identifier. /// </param> public virtual void AddContainerMetaInfo( UPContainerMetaInfo containerMetaInfo, string recordIdentification, string linkRecordIdentification, int linkId) { if (this.SupportsMultipleQueries == false) { return; } if (containerMetaInfo == null) { return; } var queryDefinitionValue = JsonConvert.SerializeObject(containerMetaInfo.QueryToObject()); if (string.IsNullOrEmpty(queryDefinitionValue)) { return; } this.ContainerMetaInfos.Add(containerMetaInfo); this.QueryParameters[$"QueryDef{this.NumberOfQueries}"] = queryDefinitionValue; if (!string.IsNullOrEmpty(linkRecordIdentification)) { this.QueryParameters[$"LinkRecordIdentification{this.NumberOfQueries}"] = linkRecordIdentification; if (linkId >= 0) { this.QueryParameters[$"LinkId{this.NumberOfQueries}"] = $"{linkId}"; } } if (!string.IsNullOrEmpty(recordIdentification)) { this.QueryParameters[$"RecordIdentification{this.NumberOfQueries}"] = recordIdentification; } if (containerMetaInfo.MaxResults > 0) { this.QueryParameters[$"MaxResults{this.NumberOfQueries}"] = $"{containerMetaInfo.MaxResults + 1}"; } this.NumberOfQueries++; }