From b2c7de542f493cf3f4759d399e1db2011d8adbae Mon Sep 17 00:00:00 2001 From: ChristopheRib63 <83826573+ChristopheRib63@users.noreply.github.com> Date: Fri, 22 Apr 2022 16:24:50 +0200 Subject: [PATCH] #604_concatenation_in_loop (#619) * feature/604_concatenation_in_loop * modification_langue Co-authored-by: crib Co-authored-by: salim ben ahben <40862545+Sben65@users.noreply.github.com> --- src/AzureIoTHub.Portal/Server/Services/ConfigService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AzureIoTHub.Portal/Server/Services/ConfigService.cs b/src/AzureIoTHub.Portal/Server/Services/ConfigService.cs index f34f23674..f4e3a6fa1 100644 --- a/src/AzureIoTHub.Portal/Server/Services/ConfigService.cs +++ b/src/AzureIoTHub.Portal/Server/Services/ConfigService.cs @@ -5,7 +5,9 @@ namespace AzureIoTHub.Portal.Server.Services { using System; using System.Collections.Generic; + using System.Globalization; using System.Linq; + using System.Text; using System.Threading.Tasks; using Extensions; using Microsoft.Azure.Devices; @@ -100,10 +102,13 @@ public async Task RollOutDeviceConfiguration( newConfiguration.Labels.Add("created-by", "Azure IoT hub Portal"); newConfiguration.Labels.Add("configuration-id", configurationId); - var targetCondition = string.Empty; + var culture = CultureInfo.CreateSpecificCulture("en-En"); + var targetCondition = new StringBuilder(); + foreach (var item in targetTags) { - targetCondition += $" and tags.{item.Key} = '{item.Value}'"; + _ = targetCondition.AppendFormat(culture, " and tags.{0}", item.Key); + _ = targetCondition.AppendFormat(culture, " = '{0}'", item.Value); } newConfiguration.TargetCondition = $"tags.modelId = '{modelId}'" + targetCondition;