예제 #1
0
        /// <summary>
        /// Adds a <see cref="ConfigurationSection"/> to the configuration source location specified by 
        /// <paramref name="saveParameter"/> and saves the configuration source.
        /// </summary>
        /// <remarks>
        /// If a configuration section with the specified name already exists in the location specified by 
        /// <paramref name="saveParameter"/> it will be replaced.
        /// </remarks>
        /// <param name="saveParameter">The <see cref="IConfigurationParameter"/> that represents the location where 
        /// to save the updated configuration. Must be an instance of <see cref="FileConfigurationParameter"/>.</param>
        /// <param name="sectionName">The name by which the <paramref name="configurationSection"/> should be added.</param>
        /// <param name="configurationSection">The configuration section to add.</param>
        public void Add(IConfigurationParameter saveParameter, string sectionName, ConfigurationSection configurationSection)
        {
            FileConfigurationParameter parameter = saveParameter as FileConfigurationParameter;
            if (null == parameter) throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(FileConfigurationParameter).Name), "saveParameter");

            Save(parameter.FileName, sectionName, configurationSection);
        }
        public virtual void Save(IServiceProvider serviceProvider)
        {
            ConfigurationSectionInfo info = null;
            ConfigurationNode        node = ServiceHelper.GetCurrentRootNode(serviceProvider);

            try
            {
                IConfigurationSource    configurationSource = GetConfigurationSource(serviceProvider);
                IConfigurationParameter parameter           = GetConfigurationParameter(serviceProvider);

                info = GetConfigurationSectionInfo(serviceProvider);
                if (null != info && !string.IsNullOrEmpty(info.SectionName))
                {
                    if (null != info.Section)
                    {
                        configurationSource.Add(parameter, info.SectionName, info.Section);
                    }
                    else
                    {
                        configurationSource.Remove(parameter, info.SectionName);
                    }
                }
            }
            catch (Exception e)
            {
                ServiceHelper.LogError(serviceProvider, info != null ? info.Node : node, e);
            }
        }
 public void Remove(IConfigurationParameter removeParameter, string sectionName)
 {
     FileConfigurationParameter parameter = removeParameter as FileConfigurationParameter;
     if (parameter == null)
     {
         throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, new object[] { typeof(FileConfigurationParameter).Name }), "saveParameter");
     }
     this.Remove(parameter.FileName, sectionName);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="removeParameter"></param>
        /// <param name="sectionName"></param>
        public void Remove(IConfigurationParameter removeParameter, string sectionName)
        {
            if (null == removeParameter)
            {
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(SqlConfigurationParameter).Name), "removeParameter");
            }

            SqlConfigurationParameter parameter = removeParameter as SqlConfigurationParameter;

            Remove(parameter.ConnectionString, parameter.RemoveStoredProcedure, sectionName);
        }
예제 #5
0
        /// <summary>
        /// TODO: add comment
        /// </summary>
        /// <param name="saveParameter"></param>
        /// <param name="sectionName"></param>
        /// <param name="configurationSection"></param>
        /// <param name="protectionProviderName"></param>
        public void Add(IConfigurationParameter saveParameter, string sectionName, ConfigurationSection configurationSection, string protectionProviderName)
        {
            FileConfigurationParameter parameter = saveParameter as FileConfigurationParameter;

            if (null == parameter)
            {
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(FileConfigurationParameter).Name), "saveParameter");
            }

            Save(parameter.FileName, sectionName, configurationSection, protectionProviderName);
        }
예제 #6
0
        /// <summary>
        /// Removes a <see cref="ConfigurationSection"/> from the configuration source location specified by
        /// <paramref name="removeParameter"/> and saves the configuration source.
        /// </summary>
        /// <param name="removeParameter">The <see cref="IConfigurationParameter"/> that represents the location where
        /// to save the updated configuration. Must be an instance of <see cref="FileConfigurationParameter"/>.</param>
        /// <param name="sectionName">The name of the section to remove.</param>
        public void Remove(IConfigurationParameter removeParameter, string sectionName)
        {
            FileConfigurationParameter parameter = removeParameter as FileConfigurationParameter;

            if (null == parameter)
            {
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(FileConfigurationParameter).Name), "saveParameter");
            }

            Remove(parameter.FileName, sectionName);
        }
예제 #7
0
        public static List <IConfigurationParameter> GetConfigurationParameterList(IConfigurationKeyword pConfig)
        {
            List <IConfigurationParameter> configurationParameters    = new List <IConfigurationParameter>();
            IEnumConfigurationParameter    enumConfigurationParameter = pConfig.ConfigurationParameters;

            for (IConfigurationParameter i = enumConfigurationParameter.Next();
                 i != null;
                 i = enumConfigurationParameter.Next())
            {
                configurationParameters.Add(i);
            }
            return(configurationParameters);
        }
예제 #8
0
        public static List <IConfigurationParameter> GetConfigurationParameterList(IConfigurationKeyword pConfig)
        {
            List <IConfigurationParameter> pList   = new List <IConfigurationParameter>();
            IEnumConfigurationParameter    pEnumCP = pConfig.ConfigurationParameters;
            IConfigurationParameter        pCP     = pEnumCP.Next();

            while (pCP != null)
            {
                pList.Add(pCP);
                pCP = pEnumCP.Next();
            }
            return(pList);
        }
예제 #9
0
        private static IConfigurationParameter confparam_marshal(IntPtr configParamPtr)
        {
            IConfigurationParameter confParam = null;

            // if the platform is 64-bit, but not windows
            if (!HamLib.isWindows && HamLib.bitsize64)
            {
                confParam = Marshal.PtrToStructure <ConfigurationParameter64> (configParamPtr);
            }
            else
            {
                confParam = Marshal.PtrToStructure <ConfigurationParameter32> (configParamPtr);
            }

            return(confParam);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="saveParameter"></param>
        /// <param name="sectionName"></param>
        /// <param name="configurationSection"></param>
        public void Add(IConfigurationParameter saveParameter, string sectionName, ConfigurationSection configurationSection)
        {
            if (null == saveParameter)
            {
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(SqlConfigurationParameter).Name), "saveParameter");
            }
            if (!(configurationSection is SerializableConfigurationSection))
            {
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(SerializableConfigurationSection).Name), "configurationSection");
            }

            SqlConfigurationParameter        parameter           = saveParameter as SqlConfigurationParameter;
            SerializableConfigurationSection serializableSection =
                configurationSection as SerializableConfigurationSection;

            Save(parameter.ConnectionString, parameter.SetStoredProcedure, sectionName, serializableSection);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="removeParameter"></param>
        /// <param name="sectionName"></param>
        public void Remove(IConfigurationParameter removeParameter, string sectionName)
        {
            if (null == removeParameter)
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(SqlConfigurationParameter).Name), "removeParameter");

            SqlConfigurationParameter parameter = removeParameter as SqlConfigurationParameter;
            Remove(parameter.ConnectionString, parameter.RemoveStoredProcedure, sectionName);
        }
예제 #12
0
 /// <summary>
 /// Null implementation of <see cref="IConfigurationSource.Remove(IConfigurationParameter, string)"/> that
 /// ignores the request.
 /// </summary>
 /// <param name="removeParameter">The <see cref="IConfigurationParameter"/> that represents the location where
 /// to save the updated configuration.</param>
 /// <param name="sectionName">The name of the section to remove.</param>
 public void Remove(IConfigurationParameter removeParameter, string sectionName)
 {
 }
예제 #13
0
 /// <summary>
 /// Adds a <see cref="ConfigurationSection"/> to the configuration source location specified by
 /// <paramref name="saveParameter"/> and saves the configuration source.
 /// </summary>
 /// <remarks>
 /// This operation is not implemented.
 /// </remarks>
 public void Add(IConfigurationParameter saveParameter,
                 string sectionName,
                 ConfigurationSection configurationSection)
 {
     throw new NotImplementedException(Resources.ManageableConfigurationSourceUpdateNotAvailable);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="saveParameter"></param>
        /// <param name="sectionName"></param>
        /// <param name="configurationSection"></param>
        public void Add(IConfigurationParameter saveParameter, string sectionName, ConfigurationSection configurationSection)
        {
            if (null == saveParameter) 
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(SqlConfigurationParameter).Name), "saveParameter");
            if (!(configurationSection is SerializableConfigurationSection))
                throw new ArgumentException(string.Format(Resources.Culture, Resources.ExceptionUnexpectedType, typeof(SerializableConfigurationSection).Name), "configurationSection");

            SqlConfigurationParameter parameter = saveParameter as SqlConfigurationParameter;
            SerializableConfigurationSection serializableSection =
                configurationSection as SerializableConfigurationSection;

            Save(parameter.ConnectionString, parameter.SetStoredProcedure, sectionName, serializableSection);
        }
 public void Add(IConfigurationParameter saveParameter, string sectionName,
                 ConfigurationSection configurationSection)
 {
         
 }
 public void Remove(IConfigurationParameter removeParameter, string sectionName)
 {
         
 }
 public void Remove(IConfigurationParameter removeParameter, string sectionName)
 {
     throw new NotImplementedException();
 }
예제 #18
0
 /// <summary>
 /// Removes a <see cref="ConfigurationSection"/> from the configuration source location specified by
 /// <paramref name="removeParameter"/> and saves the configuration source.
 /// </summary>
 /// <remarks>
 /// This operation is not implemented.
 /// </remarks>
 public void Remove(IConfigurationParameter removeParameter,
                    string sectionName)
 {
     throw new NotImplementedException(Resources.ManageableConfigurationSourceUpdateNotAvailable);
 }
		/// <summary>
		/// Adds a <see cref="ConfigurationSection"/> to the configuration source location specified by 
		/// <paramref name="saveParameter"/> and saves the configuration source.
		/// </summary>
		/// <remarks>
		/// This operation is not implemented.
		/// </remarks>
		public void Add(IConfigurationParameter saveParameter, string sectionName, ConfigurationSection configurationSection)
		{
			throw new NotImplementedException(Resources.ManageableConfigurationSourceUpdateNotAvailable);
		}
 public void Add(IConfigurationParameter saveParameter, string sectionName, System.Configuration.ConfigurationSection configurationSection)
 {
     throw new NotImplementedException();
 }
		/// <summary>
		/// Removes a <see cref="ConfigurationSection"/> from the configuration source location specified by 
		/// <paramref name="removeParameter"/> and saves the configuration source.
		/// </summary>
		/// <remarks>
		/// This operation is not implemented.
		/// </remarks>
		public void Remove(IConfigurationParameter removeParameter, string sectionName)
		{
			throw new NotImplementedException(Resources.ManageableConfigurationSourceUpdateNotAvailable);
		}
예제 #22
0
 /// <summary>
 /// Null implementation of <see cref="IConfigurationSource.Add(IConfigurationParameter, string, ConfigurationSection)"/> that
 /// ignores the request.
 /// </summary>
 /// <param name="saveParameter">The <see cref="IConfigurationParameter"/> that represents the location where
 /// to save the updated configuration.</param>
 /// <param name="sectionName">The name by which the <paramref name="configurationSection"/> should be added.</param>
 /// <param name="configurationSection">The configuration section to add.</param>
 public void Add(IConfigurationParameter saveParameter, string sectionName, ConfigurationSection configurationSection)
 {
 }
예제 #23
0
파일: Configurator.cs 프로젝트: 0anion0/IBN
        public IConfigurationParameter[] ListCompanyProperties(string companyId)
        {
            IConfigurationParameter[] result = new IConfigurationParameter[] { };

            using (SafeXmlDocument serverConfig = new SafeXmlDocument(_serverConfigPath, FileAccess.Read))
            {
                CompanyInfo company = CompanyInfo.LoadExtendedInfo(serverConfig.LoadDocument(), companyId, _dbHelper);
                if (company != null)
                {
                    try
                    {
                        _dbHelper.Database = company.Database;
                        result = Portal.ListPortalParameters(_dbHelper);
                    }
                    finally
                    {
                        _dbHelper.Database = null;
                    }
                }
            }

            return result;
        }