1- using Microsoft . Extensions . Options ;
1+ using Microsoft . Extensions . Configuration ;
2+ using Microsoft . Extensions . Options ;
3+ using Newtonsoft . Json . Linq ;
4+ using System . Text ;
25
36namespace API
47{
@@ -93,7 +96,9 @@ public static IDictionary<string, string> ReadJSONSettings(decimal? inMemoryVers
9396 }
9497 else
9598 {
96- dictionary . Add ( val . Key , val . Value ) ;
99+
100+ var combinedValue = CombineSectionValues ( val ) ;
101+ dictionary . Add ( val . Key , combinedValue ) ;
97102 }
98103 }
99104 }
@@ -102,12 +107,35 @@ public static IDictionary<string, string> ReadJSONSettings(decimal? inMemoryVers
102107 return dictionary ;
103108 }
104109 }
105-
106110
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 )
108114 {
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 ( ) ;
109126
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+ {
111139 var inputParamList = new List < ADO_inputParams > ( )
112140 {
113141 new ADO_inputParams ( ) { name = "@app_settings_version" , value = inMemoryVersion } ,
0 commit comments