private static void FillFiles(FileGroup filegroup, string connectionString) { using (SqlConnection conn = new SqlConnection(connectionString)) { using (SqlCommand command = new SqlCommand(GetSQLFile(filegroup), conn)) { conn.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { FileGroupFile item = new FileGroupFile(filegroup); item.Id = (int)reader["file_id"]; item.Name = reader["name"].ToString(); item.Owner = ""; item.Growth = (int)reader["growth"]; item.IsPercentGrowth = (bool)reader["is_percent_growth"]; item.IsSparse = (bool)reader["is_sparse"]; item.MaxSize = (int)reader["max_size"]; item.PhysicalName = reader["physical_name"].ToString(); item.Size = (int)reader["size"]; item.Type = (byte)reader["type"]; filegroup.Files.Add(item); } } } } }
public static Boolean Compare(FileGroup origen, FileGroup destino) { if (destino == null) throw new ArgumentNullException("destino"); if (origen == null) throw new ArgumentNullException("origen"); if (origen.IsReadOnly != destino.IsReadOnly) return false; if (origen.IsDefaultFileGroup != destino.IsDefaultFileGroup) return false; if (origen.IsFileStream != destino.IsFileStream) return false; return true; }
/// <summary> /// Clona el objeto FileGroups en una nueva instancia. /// </summary> public FileGroupFiles Clone(FileGroup parentObject) { FileGroupFiles columns = new FileGroupFiles(parentObject); for (int index = 0; index < this.Count; index++) { columns.Add((FileGroupFile)this[index].Clone(parentObject)); } return(columns); }
public override ISchemaBase Clone(ISchemaBase parent) { FileGroup file = new FileGroup(parent); file.IsDefaultFileGroup = this.IsDefaultFileGroup; file.IsReadOnly = this.IsReadOnly; file.Name = this.Name; file.Id = this.Id; file.Files = this.Files.Clone(file); file.Guid = this.Guid; file.IsFileStream = this.IsFileStream; return file; }
public override ISchemaBase Clone(ISchemaBase parent) { FileGroup file = new FileGroup(parent); file.IsDefaultFileGroup = this.IsDefaultFileGroup; file.IsReadOnly = this.IsReadOnly; file.Name = this.Name; file.Id = this.Id; file.Files = this.Files.Clone(file); file.Guid = this.Guid; file.IsFileStream = this.IsFileStream; return(file); }
private static string GetSQLFile(FileGroup filegroup) { string sql; sql = "select file_id,"; sql += "type,"; sql += "name,"; sql += "physical_name,"; sql += "size,"; sql += "max_size,"; sql += "growth,"; sql += "is_sparse,"; sql += "is_percent_growth "; sql += "from sys.database_files WHERE data_space_id = " + filegroup.Id.ToString(); return sql; }
public static Boolean Compare(FileGroup origen, FileGroup destino) { if (destino == null) { throw new ArgumentNullException("destino"); } if (origen == null) { throw new ArgumentNullException("origen"); } if (origen.IsReadOnly != destino.IsReadOnly) { return(false); } if (origen.IsDefaultFileGroup != destino.IsDefaultFileGroup) { return(false); } if (origen.IsFileStream != destino.IsFileStream) { return(false); } return(true); }
/// <summary> /// Constructor de la clase. /// </summary> /// <param name="parent"> /// Objeto Database padre. /// </param> public FileGroupFiles(FileGroup parent) { this.parent = parent; }
public void Fill(Database database, string connectionString) { try { if (database.Options.Ignore.FilterTableFileGroup) { using (SqlConnection conn = new SqlConnection(connectionString)) { using (SqlCommand command = new SqlCommand(GetSQL(), conn)) { conn.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { FileGroup item = new FileGroup(database); item.Id = (int)reader["ID"]; item.Name = reader["name"].ToString(); item.Owner = ""; item.IsDefaultFileGroup = (bool)reader["is_default"]; item.IsReadOnly = (bool)reader["is_read_only"]; item.IsFileStream = reader["type"].Equals("FD"); FillFiles(item,connectionString); database.FileGroups.Add(item); } } } } } } catch { throw; } }