Example #1
0
 /// <summary>
 /// Clona el objeto en una nueva instancia.
 /// </summary>
 public override ISchemaBase Clone(ISchemaBase parent)
 {
     StoreProcedure item = new StoreProcedure(parent);
     item.Text = this.Text;
     item.Status = this.Status;
     item.Name = this.Name;
     item.Id = this.Id;
     item.Owner = this.Owner;
     item.Guid = this.Guid;
     return item;
 }
 public void Fill(Database database, string connectionString)
 {
     if ((database.Options.Ignore.FilterStoreProcedure) || (database.Options.Ignore.FilterCLRStoreProcedure))
     {
         root.RaiseOnReading(new ProgressEventArgs("Reading Store Procedures...", Constants.READING_PROCEDURES));
         using (SqlConnection conn = new SqlConnection(connectionString))
         {
             using (SqlCommand command = new SqlCommand(GetSQL(database.Info.Version), conn))
             {
                 conn.Open();
                 command.CommandTimeout = 0;
                 using (SqlDataReader reader = command.ExecuteReader())
                 {
                     while (reader.Read())
                     {
                         InitIndex(reader);
                         root.RaiseOnReadingOne(reader[NameIndex]);
                         if ((reader[typeIndex].ToString().Trim().Equals("P")) && (database.Options.Ignore.FilterStoreProcedure))
                         {
                             StoreProcedure item = new StoreProcedure(database);
                             item.Id = (int)reader[object_idIndex];
                             item.Name = (string)reader[NameIndex];
                             item.Owner = (string)reader[ownerIndex];
                             item.CreateDate = (DateTime)reader[createDateIndex];
                             item.ModifyDate = (DateTime)reader[modifyDateIndex];
                             database.Procedures.Add(item);                                    
                         }
                         if ((reader[typeIndex].ToString().Trim().Equals("PC")) && (database.Options.Ignore.FilterCLRStoreProcedure))
                         {
                             CLRStoreProcedure item = new CLRStoreProcedure(database);
                             item.Id = (int)reader[object_idIndex];
                             item.Name = reader[NameIndex].ToString();
                             item.Owner = reader[ownerIndex].ToString();
                             item.IsAssembly = true;
                             item.AssemblyId = (int)reader["assembly_id"];
                             item.AssemblyName = reader["assembly_name"].ToString();
                             item.AssemblyClass = reader["assembly_class"].ToString();
                             item.AssemblyExecuteAs = reader["ExecuteAs"].ToString();
                             item.AssemblyMethod = reader["assembly_method"].ToString();
                             database.CLRProcedures.Add(item);
                         }                                
                     }
                 }
             }                    
         }
         if (database.CLRProcedures.Count > 0)
             FillParameters(database, connectionString);
     }
 }