/// <summary> /// Merges the values from headers and config into config instance. /// </summary> /// <param name="config">The appication configuration to use.</param> /// <param name="headers">The configuration headers.</param> private void MergeValuesFromHeaders(AppConfigBase config, Dictionary <string, string> headers) { if (headers != null) { Type configType = config.GetType(); foreach (string key in headers.Keys) { PropertyInfo propInfo = configType.GetProperty(key, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); if (propInfo != null && propInfo.PropertyType == typeof(string)) { propInfo.SetValue(config, headers[key], null); } } } }
/// <summary> /// Protected constructor. Use this version from a derived class if you want /// the library to use all settings from App.config. /// </summary> /// <remarks>This constructor exists for backward compatibility purposes. /// </remarks> protected AdsUser(AppConfigBase config, Dictionary <string, string> headers) { this.config = config; MergeValuesFromHeaders(config, headers); RegisterServices(GetServiceTypes()); if (this.config.EnableSoapExtension) { listeners.AddRange(GetDefaultListeners()); } SetHeadersFromConfig(); config.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "OAuth2Mode") { SetOAuthProvider(config); } }; SetOAuthProvider(config); }
/// <summary> /// Protected constructor. Use this version from a derived class if you want /// the library to use all settings from App.config. /// </summary> protected AdsUser(AppConfigBase config) : this(config, null) { }