Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
Binding to Object Data Source Problem
posted

We are making an application that needs to bind to a data object that we defined in a similar fashion to what is described in the documentation on page 43.

However, we are running into an issue within the report designer when we try to add this as a data source.  It is not selectable.  The problem seems to be that our object type has a constructor that requires several parameters; this is the reason why it does not seem to be selectable.  When we add a default constructor back into the code, it works.  You can try it with the code supplied in the documentation.  Within the project class, add a constructor that takes in one or more arguments and it will then cease to be able to be bind-able.

Is this a bug?  An oversight?  Or just a requirement that must be lived with?  It just seems odd that we should have to define a default constructor for this just to be able to bind to this object.

On a related note, is it possible to make the object type an interface?  So far it doesn't seem to be supported unless the object type is a concrete class.  Is this by design or is this something that might change in later builds?

One last question... is the design team aware of random crashes that happen periodically while within the report designer?  I wish I had more information about these crashes at the moment, but I can't seem to replicate this now that I need it to happen. 

Overall, I think you guys are doing a great job with this tool and it seems to be coming along very nicely.

Parents
No Data
Reply
  • 3070
    posted

    Hi,

    If I understand correctly you have something like this:

    public class ObjectSource

    {

        public ObjectSource(int a) { }

     

        public IEnumerable<Product> GetProducts()

        {

            List<Product> products = new List<Product>();

            for (int i = 0; i < 10; i++)

            {

                products.Add(new Product() { Code = i, Price = i * 1.5, });

            }

                

            return products;

        }

    }

     

    This is not supported right now. Instead of adding the default constructor you can define GetProducts() as static receiving the parameters you need, as follows:

    public class ObjectSource

    {

        public ObjectSource(int a) { }

     

        public static IEnumerable<Product> GetProducts(int a)

        {

            List<Product> products = new List<Product>();

            for (int i = 0; i < 10; i++)

            {

                products.Add(new Product() { Code = i, Price = i * 1.5, });

            }

               

            return products;

        }

    }

     

    Do this works for you?

    In the CTP there was a limitation that doesn’t allow creating ODS from an interface. We will review this for V1.

    We are not aware of those crashes. Is this happening often? Do you remember what you were doing when it crash? Can you give me more information about your system configuration?

    Thanks a lot for your feedback!

    Leo

Children