protected override void GetProperties(Hashtable propertyDescriptors) { foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(this, true)) { bool flag2 = false; bool isReadOnly = false; string displayName = descriptor.DisplayName; if ("Integrated Security" == displayName) { flag2 = true; isReadOnly = descriptor.IsReadOnly; } else { if (!("Password" == displayName) && !("User ID" == displayName)) { continue; } isReadOnly = this.IntegratedSecurity; } Attribute[] attributesFromCollection = this.GetAttributesFromCollection(descriptor.Attributes); System.Data.Common.DbConnectionStringBuilderDescriptor descriptor2 = new System.Data.Common.DbConnectionStringBuilderDescriptor(descriptor.Name, descriptor.ComponentType, descriptor.PropertyType, isReadOnly, attributesFromCollection) { RefreshOnChange = flag2 }; propertyDescriptors[displayName] = descriptor2; } base.GetProperties(propertyDescriptors); }
protected override void GetProperties(Hashtable propertyDescriptors) { foreach(PropertyDescriptor reflected in TypeDescriptor.GetProperties(this, true)) { bool refreshOnChange = false; bool isReadonly = false; string displayName = reflected.DisplayName; // 'Password' & 'User ID' will be readonly if 'Integrated Security' is true if (DbConnectionStringKeywords.IntegratedSecurity == displayName) { refreshOnChange = true; isReadonly = reflected.IsReadOnly; } else if ((DbConnectionStringKeywords.Password == displayName) || (DbConnectionStringKeywords.UserID == displayName)) { isReadonly = IntegratedSecurity; } else { continue; } Attribute[] attributes = GetAttributesFromCollection(reflected.Attributes); DbConnectionStringBuilderDescriptor descriptor = new DbConnectionStringBuilderDescriptor(reflected.Name, reflected.ComponentType, reflected.PropertyType, isReadonly, attributes); descriptor.RefreshOnChange = refreshOnChange; propertyDescriptors[displayName] = descriptor; } base.GetProperties(propertyDescriptors); }
protected virtual void GetProperties(Hashtable propertyDescriptors) { long logScopeId = DataCommonEventSource.Log.EnterScope("<comm.DbConnectionStringBuilder.GetProperties|API> {0}", ObjectID); try { // show all strongly typed properties (not already added) // except ConnectionString iff BrowsableConnectionString Attribute[] attributes; foreach (PropertyDescriptor reflected in TypeDescriptor.GetProperties(this, true)) { if (ADP.ConnectionString != reflected.Name) { string displayName = reflected.DisplayName; if (!propertyDescriptors.ContainsKey(displayName)) { attributes = GetAttributesFromCollection(reflected.Attributes); PropertyDescriptor descriptor = new DbConnectionStringBuilderDescriptor(reflected.Name, reflected.ComponentType, reflected.PropertyType, reflected.IsReadOnly, attributes); propertyDescriptors[displayName] = descriptor; } // else added by derived class first } else if (BrowsableConnectionString) { propertyDescriptors[ADP.ConnectionString] = reflected; } else { propertyDescriptors.Remove(ADP.ConnectionString); } } // all keywords in Keys list that do not have strongly typed property, ODBC case if (!IsFixedSize) { attributes = null; foreach (string keyword in Keys) { if (!propertyDescriptors.ContainsKey(keyword)) { object value = this[keyword]; Type vtype; if (null != value) { vtype = value.GetType(); if (typeof(string) == vtype) { int tmp1; if (int.TryParse((string)value, out tmp1)) { vtype = typeof(int); } else { bool tmp2; if (bool.TryParse((string)value, out tmp2)) { vtype = typeof(bool); } } } } else { vtype = typeof(string); } Attribute[] useAttributes = attributes; if (StringComparer.OrdinalIgnoreCase.Equals(DbConnectionStringKeywords.Password, keyword) || StringComparer.OrdinalIgnoreCase.Equals(DbConnectionStringSynonyms.Pwd, keyword)) { useAttributes = new Attribute[] { BrowsableAttribute.Yes, PasswordPropertyTextAttribute.Yes, RefreshPropertiesAttribute.All, }; } else if (null == attributes) { attributes = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, }; useAttributes = attributes; } PropertyDescriptor descriptor = new DbConnectionStringBuilderDescriptor(keyword, GetType(), vtype, false, useAttributes); propertyDescriptors[keyword] = descriptor; } } } } finally { DataCommonEventSource.Log.ExitScope(logScopeId); } }
protected virtual void GetProperties(Hashtable propertyDescriptors) { IntPtr hscp; Bid.ScopeEnter(out hscp, "<comm.DbConnectionStringBuilder.GetProperties|API> %d#", ObjectID); try { // show all strongly typed properties (not already added) // except ConnectionString iff BrowsableConnectionString Attribute[] attributes; foreach (PropertyDescriptor reflected in TypeDescriptor.GetProperties(this, true)) { if (ADP.ConnectionString != reflected.Name) { string displayName = reflected.DisplayName; if (!propertyDescriptors.ContainsKey(displayName)) { attributes = GetAttributesFromCollection(reflected.Attributes); PropertyDescriptor descriptor = new DbConnectionStringBuilderDescriptor(reflected.Name, reflected.ComponentType, reflected.PropertyType, reflected.IsReadOnly, attributes); propertyDescriptors[displayName] = descriptor; } // else added by derived class first } else if (BrowsableConnectionString) { propertyDescriptors[ADP.ConnectionString] = reflected; } else { propertyDescriptors.Remove(ADP.ConnectionString); } } // all keywords in Keys list that do not have strongly typed property, ODBC case // ignore 'Workaround Oracle Bug 914652' via IsFixedSize if (!IsFixedSize) { attributes = null; foreach (string keyword in Keys) { if (!propertyDescriptors.ContainsKey(keyword)) { object value = this[keyword]; Type vtype; if (null != value) { vtype = value.GetType(); if (typeof(string) == vtype) { int tmp1; if (Int32.TryParse((string)value, out tmp1)) { vtype = typeof(Int32); } else { bool tmp2; if (Boolean.TryParse((string)value, out tmp2)) { vtype = typeof(Boolean); } } } } else { vtype = typeof(string); } Attribute[] useAttributes = attributes; if (StringComparer.OrdinalIgnoreCase.Equals(DbConnectionStringKeywords.Password, keyword) || StringComparer.OrdinalIgnoreCase.Equals(DbConnectionStringSynonyms.Pwd, keyword)) { useAttributes = new Attribute[] { BrowsableAttribute.Yes, PasswordPropertyTextAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Security), RefreshPropertiesAttribute.All, }; } else if (null == attributes) { attributes = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, }; useAttributes = attributes; } PropertyDescriptor descriptor = new DbConnectionStringBuilderDescriptor(keyword, this.GetType(), vtype, false, useAttributes); propertyDescriptors[keyword] = descriptor; } } } } finally { Bid.ScopeLeave(ref hscp); } }
protected virtual void GetProperties(Hashtable propertyDescriptors) { IntPtr hscp; Bid.ScopeEnter(out hscp, "<comm.DbConnectionStringBuilder.GetProperties|API> %d#", ObjectID); try { // show all strongly typed properties (not already added) // except ConnectionString iff BrowsableConnectionString Attribute[] attributes; foreach(PropertyDescriptor reflected in TypeDescriptor.GetProperties(this, true)) { if (ADP.ConnectionString != reflected.Name) { string displayName = reflected.DisplayName; if (!propertyDescriptors.ContainsKey(displayName)) { attributes = GetAttributesFromCollection(reflected.Attributes); PropertyDescriptor descriptor = new DbConnectionStringBuilderDescriptor(reflected.Name, reflected.ComponentType, reflected.PropertyType, reflected.IsReadOnly, attributes); propertyDescriptors[displayName] = descriptor; } // else added by derived class first } else if (BrowsableConnectionString) { propertyDescriptors[ADP.ConnectionString] = reflected; } else { propertyDescriptors.Remove(ADP.ConnectionString); } } // all keywords in Keys list that do not have strongly typed property, ODBC case // ignore 'Workaround Oracle Bug 914652' via IsFixedSize if (!IsFixedSize) { attributes = null; foreach(string keyword in Keys) { if (!propertyDescriptors.ContainsKey(keyword)) { object value = this[keyword]; Type vtype; if (null != value) { vtype = value.GetType(); if (typeof(string) == vtype) { int tmp1; if (Int32.TryParse((string)value, out tmp1)) { vtype = typeof(Int32); } else { bool tmp2; if (Boolean.TryParse((string)value, out tmp2)) { vtype = typeof(Boolean); } } } } else { vtype = typeof(string); } Attribute[] useAttributes = attributes; if (StringComparer.OrdinalIgnoreCase.Equals(DbConnectionStringKeywords.Password, keyword) || StringComparer.OrdinalIgnoreCase.Equals(DbConnectionStringSynonyms.Pwd, keyword)) { useAttributes = new Attribute[] { BrowsableAttribute.Yes, PasswordPropertyTextAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Security), RefreshPropertiesAttribute.All, }; } else if (null == attributes) { attributes = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, }; useAttributes = attributes; } PropertyDescriptor descriptor = new DbConnectionStringBuilderDescriptor(keyword, this.GetType(), vtype, false, useAttributes); propertyDescriptors[keyword] = descriptor; } } } } finally { Bid.ScopeLeave(ref hscp); } }
protected override void GetProperties(Hashtable propertyDescriptors) { Dictionary<string,OleDbPropertyInfo> providerInfo = GetProviderInfo(Provider); if (0 < providerInfo.Count) { foreach(OleDbPropertyInfo info in providerInfo.Values) { Keywords index; if (!_keywords.TryGetValue(info._description, out index)) { // not a strongly typed property bool isReadOnly = false; bool refreshOnChange = false; Attribute[] attributes; if (OleDbPropertySetGuid.DBInit == info._propertySet) { switch(info._propertyID) { #if DEBUG case ODB.DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO: case ODB.DBPROP_INIT_ASYNCH: case ODB.DBPROP_INIT_DATASOURCE: case ODB.DBPROP_INIT_HWND: case ODB.DBPROP_INIT_OLEDBSERVICES: Debug.Assert(false, "should be handled via strongly typed property"); goto default; #endif case ODB.DBPROP_INIT_CATALOG: case ODB.DBPROP_INIT_LOCATION: attributes = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Source), RefreshPropertiesAttribute.All, }; break; case ODB.DBPROP_INIT_TIMEOUT: case ODB.DBPROP_INIT_GENERALTIMEOUT: attributes = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Initialization), RefreshPropertiesAttribute.All, }; break; // 'Password' & 'User ID' will be readonly if 'Integrated Security' exists case ODB.DBPROP_AUTH_PASSWORD: attributes = new Attribute[] { BrowsableAttribute.Yes, PasswordPropertyTextAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Security), RefreshPropertiesAttribute.All, }; isReadOnly = ContainsKey(DbConnectionStringKeywords.IntegratedSecurity); refreshOnChange = true; break; case ODB.DBPROP_AUTH_USERID: attributes = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Security), RefreshPropertiesAttribute.All, }; isReadOnly = ContainsKey(DbConnectionStringKeywords.IntegratedSecurity); refreshOnChange = true; break; case ODB.DBPROP_AUTH_CACHE_AUTHINFO: case ODB.DBPROP_AUTH_ENCRYPT_PASSWORD: case ODB.DBPROP_AUTH_INTEGRATED: case ODB.DBPROP_AUTH_MASK_PASSWORD: case ODB.DBPROP_AUTH_PERSIST_ENCRYPTED: attributes = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Security), RefreshPropertiesAttribute.All, }; refreshOnChange = (ODB.DBPROP_AUTH_INTEGRATED == info._propertyID); break; case ODB.DBPROP_INIT_BINDFLAGS: case ODB.DBPROP_INIT_IMPERSONATION_LEVEL: case ODB.DBPROP_INIT_LCID: case ODB.DBPROP_INIT_MODE: case ODB.DBPROP_INIT_PROTECTION_LEVEL: case ODB.DBPROP_INIT_PROVIDERSTRING: case ODB.DBPROP_INIT_LOCKOWNER: attributes = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute(Res.DataCategory_Advanced), RefreshPropertiesAttribute.All, }; break; default: Debug.Assert(false, "new standard propertyid"); attributes = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, }; break; } } else if (info._description.EndsWith(" Provider", StringComparison.OrdinalIgnoreCase)) { attributes = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, new ResCategoryAttribute(Res.DataCategory_Source), new TypeConverterAttribute(typeof(OleDbConnectionStringBuilder.OleDbProviderConverter)), }; refreshOnChange = true; } else { attributes = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, new CategoryAttribute(Provider), }; } DbConnectionStringBuilderDescriptor descriptor = new DbConnectionStringBuilderDescriptor(info._description, typeof(OleDbConnectionStringBuilder), info._type, isReadOnly, attributes); descriptor.RefreshOnChange = refreshOnChange; propertyDescriptors[info._description] = descriptor; } // else strongly typed property already exists, i.e. DataSource } } base.GetProperties(propertyDescriptors); }
protected override void GetProperties(Hashtable propertyDescriptors) { Dictionary<string, OleDbPropertyInfo> providerInfo = this.GetProviderInfo(this.Provider); if (0 < providerInfo.Count) { foreach (OleDbPropertyInfo info in providerInfo.Values) { Attribute[] attributeArray; DbConnectionStringBuilderDescriptor descriptor; Keywords keywords; if (_keywords.TryGetValue(info._description, out keywords)) { continue; } bool isReadOnly = false; bool flag = false; if (OleDbPropertySetGuid.DBInit == info._propertySet) { switch (info._propertyID) { case 5: case 6: case 7: case 8: case 10: attributeArray = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute("DataCategory_Security"), RefreshPropertiesAttribute.All }; flag = 7 == info._propertyID; goto Label_0303; case 9: attributeArray = new Attribute[] { BrowsableAttribute.Yes, PasswordPropertyTextAttribute.Yes, new ResCategoryAttribute("DataCategory_Security"), RefreshPropertiesAttribute.All }; isReadOnly = this.ContainsKey("Integrated Security"); flag = true; goto Label_0303; case 12: attributeArray = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute("DataCategory_Security"), RefreshPropertiesAttribute.All }; isReadOnly = this.ContainsKey("Integrated Security"); flag = true; goto Label_0303; case 0x3d: case 0x3f: case 0x41: case 160: case 270: case 0x10f: case 0xba: attributeArray = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute("DataCategory_Advanced"), RefreshPropertiesAttribute.All }; goto Label_0303; case 0x3e: case 0xe9: attributeArray = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute("DataCategory_Source"), RefreshPropertiesAttribute.All }; goto Label_0303; case 0x42: case 0x11c: attributeArray = new Attribute[] { BrowsableAttribute.Yes, new ResCategoryAttribute("DataCategory_Initialization"), RefreshPropertiesAttribute.All }; goto Label_0303; } attributeArray = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All }; } else if (info._description.EndsWith(" Provider", StringComparison.OrdinalIgnoreCase)) { attributeArray = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, new ResCategoryAttribute("DataCategory_Source"), new TypeConverterAttribute(typeof(OleDbProviderConverter)) }; flag = true; } else { attributeArray = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All, new CategoryAttribute(this.Provider) }; } Label_0303: descriptor = new DbConnectionStringBuilderDescriptor(info._description, typeof(OleDbConnectionStringBuilder), info._type, isReadOnly, attributeArray); descriptor.RefreshOnChange = flag; propertyDescriptors[info._description] = descriptor; } } base.GetProperties(propertyDescriptors); }
protected virtual void GetProperties(Hashtable propertyDescriptors) { IntPtr ptr; Bid.ScopeEnter(out ptr, "<comm.DbConnectionStringBuilder.GetProperties|API> %d#", this.ObjectID); try { Attribute[] attributesFromCollection; foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(this, true)) { if ("ConnectionString" != descriptor.Name) { string displayName = descriptor.DisplayName; if (!propertyDescriptors.ContainsKey(displayName)) { attributesFromCollection = this.GetAttributesFromCollection(descriptor.Attributes); PropertyDescriptor descriptor3 = new DbConnectionStringBuilderDescriptor(descriptor.Name, descriptor.ComponentType, descriptor.PropertyType, descriptor.IsReadOnly, attributesFromCollection); propertyDescriptors[displayName] = descriptor3; } } else if (this.BrowsableConnectionString) { propertyDescriptors["ConnectionString"] = descriptor; } else { propertyDescriptors.Remove("ConnectionString"); } } if (!this.IsFixedSize) { attributesFromCollection = null; foreach (string str in this.Keys) { if (!propertyDescriptors.ContainsKey(str)) { Type type; object obj2 = this[str]; if (obj2 != null) { type = obj2.GetType(); if (typeof(string) == type) { int num; if (int.TryParse((string) obj2, out num)) { type = typeof(int); } else { bool flag; if (bool.TryParse((string) obj2, out flag)) { type = typeof(bool); } } } } else { type = typeof(string); } Attribute[] attributes = attributesFromCollection; if (StringComparer.OrdinalIgnoreCase.Equals("Password", str) || StringComparer.OrdinalIgnoreCase.Equals("pwd", str)) { attributes = new Attribute[] { BrowsableAttribute.Yes, PasswordPropertyTextAttribute.Yes, new ResCategoryAttribute("DataCategory_Security"), RefreshPropertiesAttribute.All }; } else if (attributesFromCollection == null) { attributesFromCollection = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All }; attributes = attributesFromCollection; } PropertyDescriptor descriptor2 = new DbConnectionStringBuilderDescriptor(str, base.GetType(), type, false, attributes); propertyDescriptors[str] = descriptor2; } } } } finally { Bid.ScopeLeave(ref ptr); } }
protected virtual void GetProperties(Hashtable propertyDescriptors) { IntPtr ptr; Bid.ScopeEnter(out ptr, "<comm.DbConnectionStringBuilder.GetProperties|API> %d#", this.ObjectID); try { Attribute[] attributesFromCollection; foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(this, true)) { if ("ConnectionString" != descriptor.Name) { string displayName = descriptor.DisplayName; if (!propertyDescriptors.ContainsKey(displayName)) { attributesFromCollection = this.GetAttributesFromCollection(descriptor.Attributes); PropertyDescriptor descriptor3 = new DbConnectionStringBuilderDescriptor(descriptor.Name, descriptor.ComponentType, descriptor.PropertyType, descriptor.IsReadOnly, attributesFromCollection); propertyDescriptors[displayName] = descriptor3; } } else if (this.BrowsableConnectionString) { propertyDescriptors["ConnectionString"] = descriptor; } else { propertyDescriptors.Remove("ConnectionString"); } } if (!this.IsFixedSize) { attributesFromCollection = null; foreach (string str in this.Keys) { if (!propertyDescriptors.ContainsKey(str)) { Type type; object obj2 = this[str]; if (obj2 != null) { type = obj2.GetType(); if (typeof(string) == type) { int num; if (int.TryParse((string)obj2, out num)) { type = typeof(int); } else { bool flag; if (bool.TryParse((string)obj2, out flag)) { type = typeof(bool); } } } } else { type = typeof(string); } Attribute[] attributes = attributesFromCollection; if (StringComparer.OrdinalIgnoreCase.Equals("Password", str) || StringComparer.OrdinalIgnoreCase.Equals("pwd", str)) { attributes = new Attribute[] { BrowsableAttribute.Yes, PasswordPropertyTextAttribute.Yes, new ResCategoryAttribute("DataCategory_Security"), RefreshPropertiesAttribute.All }; } else if (attributesFromCollection == null) { attributesFromCollection = new Attribute[] { BrowsableAttribute.Yes, RefreshPropertiesAttribute.All }; attributes = attributesFromCollection; } PropertyDescriptor descriptor2 = new DbConnectionStringBuilderDescriptor(str, base.GetType(), type, false, attributes); propertyDescriptors[str] = descriptor2; } } } } finally { Bid.ScopeLeave(ref ptr); } }