Пример #1
0
 /// <summary>
 /// Clona el objeto en una nueva instancia.
 /// </summary>
 public override ISchemaBase Clone(ISchemaBase parent)
 {
     View item = new View(parent);
     item.Text = this.Text;
     item.Status = this.Status;
     item.Name = this.Name;
     item.Id = this.Id;
     item.Owner = this.Owner;
     item.IsSchemaBinding = this.IsSchemaBinding;
     item.DependenciesIn  = this.DependenciesIn;
     item.DependenciesOut = this.DependenciesOut;
     item.Indexes = this.Indexes.Clone(item);
     item.Triggers = this.Triggers.Clone(item);
     return item;
 }
Пример #2
0
 private void FillView(Database database, string connectionString)
 {
     int lastViewId = 0;
     using (SqlConnection conn = new SqlConnection(connectionString))
     {
         using (SqlCommand command = new SqlCommand(ViewSQLCommand.GetView(database.Info.Version), conn))
         {
             conn.Open();
             command.CommandTimeout = 0;
             using (SqlDataReader reader = command.ExecuteReader())
             {
                 View item = null;
                 while (reader.Read())
                 {
                     root.RaiseOnReadingOne(reader["name"]);
                     if (lastViewId != (int)reader["object_id"])
                     {
                         item = new View(database);
                         item.Id = (int)reader["object_id"];
                         item.Name = reader["name"].ToString();
                         item.Owner = reader["owner"].ToString();
                         item.IsSchemaBinding = reader["IsSchemaBound"].ToString().Equals("1");
                         database.Views.Add(item);
                         lastViewId = item.Id;
                     }
                     if (item.IsSchemaBinding)
                     {
                         if (!reader.IsDBNull(reader.GetOrdinal("referenced_major_id")))
                             database.Dependencies.Add(database,(int)reader["referenced_major_id"], item);
                         if (!String.IsNullOrEmpty(reader["TableName"].ToString()))
                             item.DependenciesIn.Add(reader["TableName"].ToString());
                         if (!String.IsNullOrEmpty(reader["DependOut"].ToString()))
                             item.DependenciesOut.Add(reader["DependOut"].ToString());
                     }
                 }
             }
         }
     }
 }