Exemple #1
0
        /// <summary>
        /// Deletes the specified named connection element.
        /// </summary>
        /// <param name="namedConnectionElement">The named connection element.</param>
        public static void Delete(NamedConnectionElement namedConnectionElement)
        {
            var section = SettingsGroup.MonahrqSettings();

            section.NamedConnections.Remove(section.NamedConnections[namedConnectionElement.Name]);
            Save(section);
        }
Exemple #2
0
        /// <summary>
        /// Saves the specified named connection element.
        /// </summary>
        /// <param name="namedConnectionElement">The named connection element.</param>
        public void Save(NamedConnectionElement namedConnectionElement)
        {
            var current = _monahrqConfigurationSettings.NamedConnections.OfType <NamedConnectionElement>().FirstOrDefault(elem => elem.Name == namedConnectionElement.Name);

            if (current != null)
            {
                _monahrqConfigurationSettings.NamedConnections.Remove(current);
            }
            _monahrqConfigurationSettings.NamedConnections.Add(namedConnectionElement);
            MonahrqConfiguration.Save(_monahrqConfigurationSettings);
        }
Exemple #3
0
 /// <summary>
 /// Copies the specified source.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="target">The target.</param>
 public static void Copy(NamedConnectionElement source, NamedConnectionElement target)
 {
     target.Name              = source.Name;
     target.ConnectionString  = source.ConnectionString;
     target.ControllerType    = source.ControllerType;
     target.SelectFrom        = source.SelectFrom;
     target.HasHeader         = source.HasHeader;
     target.SchemaIniSettings = new SchemaIniElementCollection();
     foreach (var element in source.SchemaIniSettings.OfType <SchemaIniElement>())
     {
         target.SchemaIniSettings.Add(new SchemaIniElement(element.Name, element.Value));
     }
 }
Exemple #4
0
 /// <summary>
 /// Copies from.
 /// </summary>
 /// <param name="source">The source.</param>
 private void CopyFrom(NamedConnectionElement source)
 {
     Copy(source, this);
 }
Exemple #5
0
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 public void CopyTo(NamedConnectionElement target)
 {
     target.CopyFrom(this);
 }