Skip to content

Commit 71eb5ba

Browse files
committed
Keeping results separated when doing a batch request
1 parent 90b9058 commit 71eb5ba

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

Excel_Adapter/CRUD/Read/Read.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private List<IBHoMObject> ReadExcel(XLWorkbook workbook, IRequest request, Actio
9090
else if (request is WorksheetsRequest)
9191
return ReadExcel(workbook, ((WorksheetsRequest)request));
9292
else if (request is BatchRequest batchRequest)
93-
return batchRequest.Requests.SelectMany(x => ReadExcel(workbook, x, actionConfig)).ToList();
93+
return batchRequest.Requests.Select(x => new ResultItem { Objects = ReadExcel(workbook, x, actionConfig), OriginalRequest = x }).ToList<IBHoMObject>();
9494
else
9595
{
9696
BH.Engine.Base.Compute.RecordError($"Requests of type {request?.GetType()} are not supported by the Excel adapter.");

Excel_oM/ResultItem.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
4+
*
5+
* Each contributor holds copyright over their respective contributions.
6+
* The project versioning (Git) records all such contribution source information.
7+
*
8+
*
9+
* The BHoM is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3.0 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* The BHoM is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21+
*/
22+
23+
using BH.oM.Base;
24+
using BH.oM.Base.Attributes;
25+
using BH.oM.Data.Requests;
26+
using System.Collections.Generic;
27+
28+
namespace BH.oM.Adapters.Excel
29+
{
30+
public class ResultItem : BHoMObject
31+
{
32+
public virtual List<IBHoMObject> Objects { get; set; } = new List<IBHoMObject>();
33+
34+
public virtual IRequest OriginalRequest { get; set; } = null;
35+
}
36+
}
37+
38+
39+

0 commit comments

Comments
 (0)