/// <summary> /// Writes the configuration data to the SSO Config Store. /// </summary> /// <param name="appName">The name of the affiliate application to represent the configuration container to access.</param> /// <param name="properties">A collection of name/value pairs that represent the configuration settings.</param> public static void Write(string appName, IDictionary <string, string> properties) { Guard.ArgumentNotNullOrEmptyString(appName, "appName"); Guard.ArgumentNotNull(properties, "properties"); var callToken = TraceManager.CustomComponent.TraceIn(appName, properties.Count); try { SSOConfigStore ssoStore = new SSOConfigStore(); SsoConfigurationPropertyBag appMgmtBag = new SsoConfigurationPropertyBag(); foreach (KeyValuePair <string, string> property in properties) { object tempPropValue = property.Value; appMgmtBag.Write(property.Key, ref tempPropValue); } ((ISSOConfigStore)ssoStore).SetConfigInfo(appName, idenifierGUID, appMgmtBag); } catch (Exception e) { TraceManager.CustomComponent.TraceError(e); throw; } finally { TraceManager.CustomComponent.TraceOut(callToken); } }
/// <summary> /// Reads the configuration data from the SSO Config Store. /// </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) { Guard.ArgumentNotNullOrEmptyString(appName, "appName"); Guard.ArgumentNotNullOrEmptyString(propName, "propName"); var callToken = TraceManager.CustomComponent.TraceIn(appName, propName); try { SSOConfigStore ssoStore = new SSOConfigStore(); SsoConfigurationPropertyBag appMgmtBag = new SsoConfigurationPropertyBag(); ((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) { TraceManager.CustomComponent.TraceError(e); throw; } finally { TraceManager.CustomComponent.TraceOut(callToken); } }