示例#1
0
 public static Boolean Compare(PartitionScheme origen, PartitionScheme destino)
 {
     if (destino == null)
     {
         throw new ArgumentNullException("destino");
     }
     if (origen == null)
     {
         throw new ArgumentNullException("origen");
     }
     if (!origen.PartitionFunction.Equals(destino.PartitionFunction))
     {
         return(false);
     }
     if (origen.FileGroups.Count != destino.FileGroups.Count)
     {
         return(false);
     }
     for (int j = 0; j < origen.FileGroups.Count; j++)
     {
         if (origen.CompareFullNameTo(origen.FileGroups[j], destino.FileGroups[j]) != 0)
         {
             return(false);
         }
     }
     return(true);
 }
 public void Fill(Database database, string connectioString)
 {
     int lastObjectId = 0;
     PartitionScheme item = null;
     if (database.Options.Ignore.FilterPartitionScheme)
     {
         using (SqlConnection conn = new SqlConnection(connectioString))
         {
             using (SqlCommand command = new SqlCommand(GetSQL(), conn))
             {
                 conn.Open();
                 command.CommandTimeout = 0;
                 using (SqlDataReader reader = command.ExecuteReader())
                 {
                     while (reader.Read())
                     {
                         if (lastObjectId != (int)reader["ID"])
                         {
                             lastObjectId = (int)reader["ID"];
                             item = new PartitionScheme(database);
                             item.Id = (int)reader["ID"];
                             item.Name = reader["name"].ToString();
                             item.PartitionFunction = reader["FunctionName"].ToString();
                             database.PartitionSchemes.Add(item);
                         }
                         item.FileGroups.Add(reader["FileGroupName"].ToString());
                     }
                 }
             }
         }
     }
 }
示例#3
0
 public static Boolean Compare(PartitionScheme origen, PartitionScheme destino)
 {
     if (destino == null) throw new ArgumentNullException("destino");
     if (origen == null) throw new ArgumentNullException("origen");
     if (!origen.PartitionFunction.Equals(destino.PartitionFunction)) return false;
     if (origen.FileGroups.Count != destino.FileGroups.Count) return false;
     for (int j = 0; j < origen.FileGroups.Count; j++)
     {
         if (origen.CompareFullNameTo(origen.FileGroups[j], destino.FileGroups[j]) != 0)
             return false;
     }
     return true;
 }