Skip to content

Commit d4a5c3a

Browse files
committed
fix: update null handling in results and improve query parameter usage
1 parent 5f84d22 commit d4a5c3a

4 files changed

Lines changed: 6 additions & 12 deletions

File tree

source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/AasRepository/AasRepositoryService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private async Task<List<IAssetAdministrationShell>> BuildShellsAsync(IEnumerable
373373

374374
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
375375

376-
return [.. results.Where(s => s is not null).Select(s => s!)];
376+
return [.. results.Where(s => s is not null).Select(s => s)];
377377
}
378378

379379
private static IList<IAssetAdministrationShell> FilterByExternalSubjectId(IList<IAssetAdministrationShell> shells, IList<SpecificAssetId>? filters)

source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRegistry/SubmodelDescriptorService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private static bool ProcessShellBatch(List<AasCore.Aas3_1.IAssetAdministrationSh
178178
{
179179
var submodelIds = GetSubmodelIdsForShell(shell);
180180

181-
if (state.CollectSubmodelIds(submodelIds, shell.Id!, pageSize))
181+
if (state.CollectSubmodelIds(submodelIds, shell.Id, pageSize))
182182
{
183183
return true;
184184
}

source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SubmodelRepositoryService.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private async Task<List<string>> GetSubmodelIdsForShellAsync(string shellId, Can
188188
{
189189
var references = await aasRepositoryTemplateService.GetSubmodelRefByIdAsync(shellId, cancellationToken).ConfigureAwait(false);
190190

191-
return references.Select(r => r.Keys.FirstOrDefault()?.Value).Where(id => !string.IsNullOrWhiteSpace(id)).ToList()!;
191+
return references.Select(r => r.Keys.FirstOrDefault()?.Value).Where(id => !string.IsNullOrWhiteSpace(id)).ToList();
192192
}
193193
catch (ResourceNotFoundException ex)
194194
{
@@ -211,13 +211,7 @@ private async Task<List<ISubmodel>> BuildSubmodelsAsync(List<string> submodelIds
211211
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
212212

213213
var submodels = new List<ISubmodel>(results.Length);
214-
foreach (var result in results)
215-
{
216-
if (result is not null)
217-
{
218-
submodels.Add(result);
219-
}
220-
}
214+
submodels.AddRange(results.Where(result => result is not null));
221215

222216
return submodels;
223217
}

source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/PluginDataProvider/Services/PluginDataProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private static string BuildShellsUrl(int? limit, string? cursor)
277277
? QueryHelpers.AddQueryString(BaseUrl, queryParams!)
278278
: BaseUrl;
279279
}
280-
280+
281281
private static string BuildShellsByAssetIdsUrl(int? limit, string? cursor)
282282
{
283283
const string BaseUrl = $"/{ApiPaths.PluginMetadata}/{ShellsEndpoint}";
@@ -294,7 +294,7 @@ private static string BuildShellsByAssetIdsUrl(int? limit, string? cursor)
294294
}
295295

296296
return queryParams.Count > 0
297-
? QueryHelpers.AddQueryString(BaseUrl, queryParams!)
297+
? QueryHelpers.AddQueryString(BaseUrl, queryParams)
298298
: BaseUrl;
299299
}
300300

0 commit comments

Comments
 (0)