I am working on a huge old project with a lot of fragile code, some of which have been since .NET 1.0, and other people have been and will work with it ... so I "Like to change as little as possible.
My solution has one project containing DataSet.xsd. This project is compiled into a separate assembly (Data.dll). A database schema includes several tables arranged more or less hierarchically, but the only way tables are actually related to each other is by joining. I can get for example. DepartmentRowand EmployeeRowobjects from auto-generated code. EmployeeRowcontains information from the employee matching DepartmentRowthrough the connection.
I am making a new report to view several departments and all their employees. If I use the existing data access scheme, all I can get is a result that looks like a table where each employee is presented on one line, and the department information is repeated again and again in the corresponding columns. For instance:.
Department1...Employee1...
Department1...Employee2...
Department2...Employee3...
But what the client would like is to have each department as a heading, with a list of employees under each. For instance:.
- Department1...
Employee1...
Employee2...
+ Department2...
I am trying to do this by inheriting hierarchical objects from objects with auto-generated Row. For instance:.
public class Department : DataSet.DepartmentRow {
public List<Employee> Employees;
}
Thus, I could attach data to the report using the collection of Department objects as a data source, each of which will place its list of employees in a subordinate report.
The problem is that it gives me an error The type Data.DataSet.DepartmentRow has no constructors defined. And when I try to create a constructor, for example
public class Department : DataSet.DepartmentRow {
private Department() { }
public List<Employee> Employees;
}
'Data.DataSet.DepartmentRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level. .
, ? - , ?