/// <summary> /// Write method helps write configuration data /// </summary> /// <param name="appName">The name of the affiliate application to represent the configuration container to access</param> /// <param name="propName">The property name to write</param> /// <param name="propName">The property value to write</param> public static void Write(string appName, string propName, object propValue) { try { SSOConfigStore ssoStore = new SSOConfigStore(); ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag(); ((ISSOConfigStore)ssoStore).GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, (IPropertyBag)appMgmtBag); object tempProp = propValue; try { appMgmtBag.Remove(propName); } catch { } appMgmtBag.Write(propName, ref tempProp); ((ISSOConfigStore)ssoStore).SetConfigInfo(appName, idenifierGUID, appMgmtBag); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.Message); throw; } }
/// <summary> /// Read method helps get configuration data /// </summary> /// <param name="appName">The name of the affiliate application to represent the configuration container to access</param> /// <param name="propName">The property name to read</param> /// <returns> /// The value of the property stored in the given affiliate application of this component. /// </returns> public static string Read(string appName, string propName) { try { SSOConfigStore ssoStore = new SSOConfigStore(); ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag(); ((ISSOConfigStore)ssoStore).GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, (IPropertyBag)appMgmtBag); object propertyValue = null; appMgmtBag.Read(propName, out propertyValue, 0); return((string)propertyValue); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.Message); throw; } }