protected override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection descriptors = base.GetProperties(attributes); if (SqlNativeClientRegistered) { DynamicPropertyDescriptor providerDescriptor = descriptors.Find("Provider", true) as DynamicPropertyDescriptor; if (providerDescriptor != null) { if (!DisableProviderSelection) { providerDescriptor.SetIsReadOnly(false); } providerDescriptor.SetConverterType(typeof(SqlProviderConverter)); } } return(descriptors); }
protected override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection descriptors = base.GetProperties(attributes); if (_disableProviderSelection) { PropertyDescriptor providerDescriptor = descriptors.Find("Provider", true); if (providerDescriptor != null) { int index = descriptors.IndexOf(providerDescriptor); PropertyDescriptor[] descriptorArray = new PropertyDescriptor[descriptors.Count]; descriptors.CopyTo(descriptorArray, 0); descriptorArray[index] = new DynamicPropertyDescriptor(providerDescriptor, ReadOnlyAttribute.Yes); (descriptorArray[index] as DynamicPropertyDescriptor).CanResetValueHandler = new CanResetValueHandler(CanResetProvider); descriptors = new PropertyDescriptorCollection(descriptorArray, true); } } return(descriptors); }
protected override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection descriptors = base.GetProperties(attributes); if (Access12ProviderRegistered) { DynamicPropertyDescriptor providerDescriptor = descriptors.Find("Provider", true) as DynamicPropertyDescriptor; if (providerDescriptor != null) { if (!DisableProviderSelection) { providerDescriptor.SetIsReadOnly(false); } providerDescriptor.SetConverterType(typeof(JetProviderConverter)); providerDescriptor.AddValueChanged(ConnectionStringBuilder, new EventHandler(OnProviderChanged)); } PropertyDescriptor dataSourceDescriptor = descriptors.Find("DataSource", true); if (dataSourceDescriptor != null) { int index = descriptors.IndexOf(dataSourceDescriptor); PropertyDescriptor[] descriptorArray = new PropertyDescriptor[descriptors.Count]; descriptors.CopyTo(descriptorArray, 0); descriptorArray[index] = new DynamicPropertyDescriptor(dataSourceDescriptor); descriptorArray[index].AddValueChanged(ConnectionStringBuilder, new EventHandler(OnDataSourceChanged)); descriptors = new PropertyDescriptorCollection(descriptorArray, true); } } PropertyDescriptor passwordDescriptor = descriptors.Find("Jet OLEDB:Database Password", true); if (passwordDescriptor != null) { int index = descriptors.IndexOf(passwordDescriptor); PropertyDescriptor[] descriptorArray = new PropertyDescriptor[descriptors.Count]; descriptors.CopyTo(descriptorArray, 0); descriptorArray[index] = new DynamicPropertyDescriptor(passwordDescriptor, PasswordPropertyTextAttribute.Yes); descriptors = new PropertyDescriptorCollection(descriptorArray, true); } return(descriptors); }