1
- using Microsoft . Extensions . Options ;
1
+ using Microsoft . Extensions . Configuration ;
2
+ using Microsoft . Extensions . Options ;
3
+ using Newtonsoft . Json . Linq ;
4
+ using System . Text ;
2
5
3
6
namespace API
4
7
{
@@ -93,7 +96,9 @@ public static IDictionary<string, string> ReadJSONSettings(decimal? inMemoryVers
93
96
}
94
97
else
95
98
{
96
- dictionary . Add ( val . Key , val . Value ) ;
99
+
100
+ var combinedValue = CombineSectionValues ( val ) ;
101
+ dictionary . Add ( val . Key , combinedValue ) ;
97
102
}
98
103
}
99
104
}
@@ -102,12 +107,35 @@ public static IDictionary<string, string> ReadJSONSettings(decimal? inMemoryVers
102
107
return dictionary ;
103
108
}
104
109
}
105
-
106
110
107
- public static void deployUpdate ( decimal ? inMemoryVersion , string configType )
111
+
112
+ // Method to recursively combine section values into a JSON string
113
+ public static string CombineSectionValues ( IConfigurationSection section )
108
114
{
115
+ // Get the children of the current section
116
+ var children = section . GetChildren ( ) ;
117
+
118
+ // If there are no children, return the section value
119
+ if ( ! children . Any ( ) )
120
+ {
121
+ return section . Value ;
122
+ }
123
+
124
+ // Create a JSON object to hold the combined values
125
+ var jsonObject = new JObject ( ) ;
109
126
110
-
127
+ // Recursively process each child section
128
+ foreach ( var child in children )
129
+ {
130
+ jsonObject [ child . Key ] = CombineSectionValues ( child ) ;
131
+ }
132
+
133
+ // Convert the JSON object to a string and return it
134
+ return jsonObject . ToString ( ) ;
135
+ }
136
+
137
+ public static void deployUpdate ( decimal ? inMemoryVersion , string configType )
138
+ {
111
139
var inputParamList = new List < ADO_inputParams > ( )
112
140
{
113
141
new ADO_inputParams ( ) { name = "@app_settings_version" , value = inMemoryVersion } ,
0 commit comments