Polymorphic Objects as DataSources RRS feed

  • Question

  • Hi, people.


    I've created an object data source, to pass a collection of IFinancialObject to a Report using Report Viewer. Then I realized that interfaces is not listed in the Data Source list of the rdlc Report. I, then, converted it in an abstract class which had some abstract properties that would be implemented in the subclasses, so my object data source would use it. It indeed was listed in dthe rdlc data sources choosing dialog, and the report worked, but whenever It uses any polymorphic property of the base abstract class, it only shows one of the subclasses implementation... when it's another subclass in the list, and the Report uses the property, it shows a "#Error" instead of the property value. I assumed that the ReportViewer Local Report doesn't work well with polymorphic objects, or something like that. Does anyone knows if there's a way to do it, though?


    I used composition, instead, but I don't like it this way. Polymorphism would be far more better, if not with interface, then at least with an abstract base class.


    Hope you have some clue.



    Monday, July 23, 2007 5:22 PM