Ejemplo n.º 1
0
        private bool OverrideWithGroupPoliciesAndGenerateWmiObjectsForConnectionString(ConnectionStringSettings connectionString,
                                                                                       bool readGroupPolicies, IRegistryKey machineKey, IRegistryKey userKey,
                                                                                       bool generateWmiObjects, ICollection <ConfigurationSetting> wmiSettings)
        {
            if (readGroupPolicies)
            {
                IRegistryKey policyKey = machineKey ?? userKey;
                if (policyKey != null)
                {
                    if (policyKey.IsPolicyKey && !policyKey.GetBoolValue(PolicyValueName).Value)
                    {
                        return(false);
                    }
                    try
                    {
                        String connectionStringOverride = policyKey.GetStringValue(ConnectionStringPropertyName);
                        String providerNameOverride     = policyKey.GetStringValue(ProviderNamePropertyName);

                        connectionString.ConnectionString = connectionStringOverride;
                        connectionString.ProviderName     = providerNameOverride;
                    }
                    catch (RegistryAccessException ex)
                    {
                        LogExceptionWhileOverriding(ex);
                    }
                }
            }
            if (generateWmiObjects)
            {
                ConnectionStringsWmiMapper.GenerateConnectionStringWmiObjects(connectionString, wmiSettings);
            }

            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initialize a new instance of the <see cref="ConnectionStringsManageabilityProvider"/> class with the sub providers.
 /// </summary>
 /// <param name="subProviders">A set of sub providers.</param>
 public ConnectionStringsManageabilityProvider(IDictionary <Type, ConfigurationElementManageabilityProvider> subProviders)
     : base(subProviders)
 {
     ConnectionStringsWmiMapper.RegisterWmiTypes();
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="configurationSection"></param>
 /// <param name="wmiSettings"></param>
 protected override void GenerateWmiObjectsForConfigurationSection(ConnectionStringsSection configurationSection,
                                                                   ICollection <ConfigurationSetting> wmiSettings)
 {
     ConnectionStringsWmiMapper.GenerateWmiObjects(configurationSection, wmiSettings);
 }
Ejemplo n.º 4
0
 protected override bool SaveChanges(ConfigurationElement sourceElement)
 {
     return(ConnectionStringsWmiMapper.SaveChanges(this, sourceElement));
 }