Exemple #1
0
        protected override void OverrideWithGroupPoliciesForConfigurationElements(
            OracleConnectionSettings configurationSection,
            bool readGroupPolicies,
            IRegistryKey machineKey,
            IRegistryKey userKey)
        {
            List <OracleConnectionData> oracleConnectionDataList = new List <OracleConnectionData>();

            foreach (OracleConnectionData connectionData in configurationSection.OracleConnectionsData)
            {
                IRegistryKey machineSubKey = (IRegistryKey)null;
                IRegistryKey userSubKey    = (IRegistryKey)null;
                try
                {
                    ConfigurationSectionManageabilityProvider.LoadRegistrySubKeys(connectionData.Name, machineKey, userKey, out machineSubKey, out userSubKey);
                    if (!this.OverrideWithGroupPoliciesForOracleConnection(connectionData, readGroupPolicies, machineSubKey, userSubKey))
                    {
                        oracleConnectionDataList.Add(connectionData);
                    }
                }
                finally
                {
                    ConfigurationSectionManageabilityProvider.ReleaseRegistryKeys(machineSubKey, userSubKey);
                }
            }
            foreach (OracleConnectionData oracleConnectionData in oracleConnectionDataList)
            {
                configurationSection.OracleConnectionsData.Remove(oracleConnectionData.Name);
            }
        }
        protected override void OverrideWithGroupPoliciesForConfigurationElements(
            ConnectionStringsSection configurationSection,
            bool readGroupPolicies,
            IRegistryKey machineKey,
            IRegistryKey userKey)
        {
            List <ConnectionStringSettings> connectionStringSettingsList = new List <ConnectionStringSettings>();

            foreach (ConnectionStringSettings connectionString in (ConfigurationElementCollection)configurationSection.ConnectionStrings)
            {
                IRegistryKey machineSubKey = (IRegistryKey)null;
                IRegistryKey userSubKey    = (IRegistryKey)null;
                try
                {
                    ConfigurationSectionManageabilityProvider.LoadRegistrySubKeys(connectionString.Name, machineKey, userKey, out machineSubKey, out userSubKey);
                    if (!this.OverrideWithGroupPoliciesForConnectionString(connectionString, readGroupPolicies, machineSubKey, userSubKey))
                    {
                        connectionStringSettingsList.Add(connectionString);
                    }
                }
                finally
                {
                    ConfigurationSectionManageabilityProvider.ReleaseRegistryKeys(machineSubKey, userSubKey);
                }
            }
            foreach (ConnectionStringSettings settings in connectionStringSettingsList)
            {
                configurationSection.ConnectionStrings.Remove(settings);
            }
        }
 public void SetUp()
 {
     provider = new OracleConnectionSettingsManageabilityProvider(new Dictionary<Type, ConfigurationElementManageabilityProvider>(0));
     machineKey = new MockRegistryKey(true);
     userKey = new MockRegistryKey(true);
     section = new OracleConnectionSettings();
 }
Exemple #4
0
 public void SetUp()
 {
     provider   = new OracleConnectionSettingsManageabilityProvider(new Dictionary <Type, ConfigurationElementManageabilityProvider>(0));
     machineKey = new MockRegistryKey(true);
     userKey    = new MockRegistryKey(true);
     section    = new OracleConnectionSettings();
 }
        public override IConfigurationSource CreateSource()
        {
            IDictionary <String, ConfigurationSectionManageabilityProvider> manageabilityProviders = new Dictionary <String, ConfigurationSectionManageabilityProvider>(this.ConfigurationManageabilityProviders.Count);
            ManageabilityProviderBuilder providerBuilder = new ManageabilityProviderBuilder();

            foreach (ConfigurationSectionManageabilityProviderData data in this.ConfigurationManageabilityProviders)
            {
                ConfigurationSectionManageabilityProvider provider
                    = providerBuilder.CreateConfigurationSectionManageabilityProvider(data);
                manageabilityProviders.Add(data.Name, provider);
            }
            return(new ManageableConfigurationSource(this.FilePath, manageabilityProviders, this.EnableGroupPolicies, this.EnableWmi, this.ApplicationName));
        }
        protected override void OverrideWithGroupPoliciesForConfigurationElements(
            DatabaseSettings configurationSection,
            bool readGroupPolicies,
            IRegistryKey machineKey,
            IRegistryKey userKey)
        {
            List <DbProviderMapping> dbProviderMappingList = new List <DbProviderMapping>();
            IRegistryKey             machineSubKey1        = (IRegistryKey)null;
            IRegistryKey             userSubKey1           = (IRegistryKey)null;

            try
            {
                ConfigurationSectionManageabilityProvider.LoadRegistrySubKeys("providerMappings", machineKey, userKey, out machineSubKey1, out userSubKey1);
                foreach (DbProviderMapping providerMapping in configurationSection.ProviderMappings)
                {
                    IRegistryKey machineSubKey2 = (IRegistryKey)null;
                    IRegistryKey userSubKey2    = (IRegistryKey)null;
                    try
                    {
                        ConfigurationSectionManageabilityProvider.LoadRegistrySubKeys(providerMapping.Name, machineSubKey1, userSubKey1, out machineSubKey2, out userSubKey2);
                        if (!this.OverrideWithGroupPoliciesForDbProviderMapping(providerMapping, readGroupPolicies, machineSubKey2, userSubKey2))
                        {
                            dbProviderMappingList.Add(providerMapping);
                        }
                    }
                    finally
                    {
                        ConfigurationSectionManageabilityProvider.ReleaseRegistryKeys(machineSubKey2, userSubKey2);
                    }
                }
            }
            finally
            {
                ConfigurationSectionManageabilityProvider.ReleaseRegistryKeys(machineSubKey1, userSubKey1);
            }
            foreach (DbProviderMapping dbProviderMapping in dbProviderMappingList)
            {
                configurationSection.ProviderMappings.Remove(dbProviderMapping.Name);
            }
        }
Exemple #7
0
 public ConfigurationSectionManageabilityProviderWrapper(ConfigurationSectionManageabilityProvider wrappedProvider)
     : base(null)
 {
     this.wrappedProvider = wrappedProvider;
 }