Class not appear as Business Object in Report Data

Answered Class not appear as Business Object in Report Data

  • Monday, July 23, 2012 8:49 AM
     
     

    Hi,

    I have created a local report in a class library and I want to use the existing business objects as the data source for the report. When I try to add the business object from the Report Data toolbox I cannot see the class that I want to choose. What I've noticed is that if the business object is a subclass of another class which exists in a another class library then it doesn't appear. Has anybody else seen this? So what I've tried is this:

    Scenario 1:

    1. Class Library 1
    • Reports folder > Report1.rdlc
    • BO folder > MyBO and MySuperClass
    • public class MyBO : MySuperClass

    When I open up Report1.rdlc and try to create a  New Object Data Source from the Report Data toolbox, MyBO class is visible and I can select it. If I change my solution to this:

    1. Class Library 2
    • namespace ClassLibrary2 { public class MySuperClass { ... } }
    1. Class Library 1
    • Reports folder > Report1.rdlc
    • BO folder > MyBO 
    • public class MyBO : ClassLibrary2.MySuperClass

    Now when I try to add the MyBO class it does not appear in the Report Data toolbox. Unfortunately I'm using a product and my Business objects have to be subclasses of the super class that is in the other class library.

    Does anyone know how to fix this issue or is this a bug?

    Kind regards

    Sidharth

All Replies

  • Tuesday, August 07, 2012 3:46 PM
     
     Answered Has Code

    Got it working by implementing the System.Collections.IEnumerable interface. I.e.

    public class MyBO : ClassLibrary2.MySuperClass, System.Collections.IEnumerable
    {
        ...
        
        #region IEnumerable Members
    
        public System.Collections.IEnumerator GetEnumerator()
        {
            return new List<MyBO> { this }.GetEnumerator();
        }
    
        #endregion
    }
    

    Kind regards

    Sidharth