Exemplo n.º 1
0
 /// <summary>
 /// Adds the elements of another TargetCollection to the end of this TargetCollection.
 /// </summary>
 /// <param name="items">
 /// The TargetCollection whose elements are to be added to the end of this TargetCollection.
 /// </param>
 public virtual void AddRange(TargetCollection items)
 {
     foreach (Target item in items)
     {
         this.List.Add(item);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(TargetCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the TargetCollection class, containing elements
 /// copied from another instance of TargetCollection
 /// </summary>
 /// <param name="items">
 /// The TargetCollection whose elements are to be added to the new TargetCollection.
 /// </param>
 public TargetCollection(TargetCollection items)
 {
     this.AddRange(items);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a collection of named targets specified in the configuration.
 /// </summary>
 /// <returns>A <see cref="TargetCollection"/> object that contains a list of named targets.</returns>
 /// <remarks>
 /// Unnamed targets (such as those wrapped by other targets) are not returned.
 /// </remarks>
 public TargetCollection GetConfiguredNamedTargets()
 {
     TargetCollection tc = new TargetCollection();
     foreach (Target t in _targets.Values)
     {
         tc.Add(t);
     }
     return tc;
 }
Exemplo n.º 5
0
        private void ReloadTargets()
        {
            TargetCollection tmp = new TargetCollection();

            using (SqlConnection reposConn = new SqlConnection(GetReposConnectionString("Manager")))
            {
                reposConn.Open();

                using (SqlCommand reposCmd = reposConn.CreateCommand())
                {
                    reposCmd.CommandText = "SELECT Id, ServerName, IsSqlAuthentication, Username, Password FROM dbo.Targets ORDER BY Id";
                    reposCmd.CommandType = CommandType.Text;

                    using (SqlDataReader reposReader = reposCmd.ExecuteReader())
                    {
                        while (reposReader.Read())
                        {
                            tmp.Add(
                                (int)reposReader["Id"],
                                new Target(
                                    (int)reposReader["Id"],
                                    reposReader["ServerName"].ToString(),
                                    (bool)reposReader["IsSqlAuthentication"],
                                    reposReader["Username"].ToString(),
                                    reposReader["Password"].ToString()
                                    )
                                );
                        }

                        reposReader.Close();
                    }
                }

                reposConn.Close();
            }

            targets = tmp;
        }
Exemplo n.º 6
0
 /// <summary>
 /// Adds the elements of another TargetCollection to the end of this TargetCollection.
 /// </summary>
 /// <param name="items">
 /// The TargetCollection whose elements are to be added to the end of this TargetCollection.
 /// </param>
 public virtual void AddRange(TargetCollection items)
 {
     foreach (Target item in items)
     {
         this.List.Add(item);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the TargetCollection class, containing elements
 /// copied from another instance of TargetCollection
 /// </summary>
 /// <param name="items">
 /// The TargetCollection whose elements are to be added to the new TargetCollection.
 /// </param>
 public TargetCollection(TargetCollection items)
 {
     this.AddRange(items);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(TargetCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }