The question is: could you bind composited object in Crystal Report .NET? For example, an Employee class can be like this:
public class Employee
{
public string m_name;
public Address m_address;
public Salary m_salary;
}
Address and Salary are also classes.
How can I bind an Employee object to Crystal Report to show detailed Address and Salary information? It turns out Crystal Report .NET can only access the top level properties of an object (only m_name in this case)! Crystal Report .NET is too lazy to dig into the object hierarchy.
Ugly solution? You should create a flat class including all properties of all children classes! A mapping method to fill data to the flat class is needed of course.
In my current project, I have a class that is composited with many other child classes. If I make all fields flat in one class, there will be more than one hundred properties.
Except that I have to spend days to create flat classes, Crystal Report also gives me a big task from now on: to keep the flat classes synchronized with those hierarchical classes.
0 comments:
Post a Comment