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.
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 static IEnumerable<Product> GetProducts(int a)
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
// populate list
public class Product
public Product (int a)
This is more so what I was talking about. This code only works if Product also has a constructor that takes zero arguments.
Pertaining to the crash, I wish I had more detailed information to give you, but it simply crashes frequently and without error messages when I am working with controls directly in the designer. I noticed that when I fill in the content of labels and tables through the fields in the property grid, I do not seem to crash at all. The crashes only occur when I am working with the GUI itself.
My version of Visual Studio is 10.0.40219.1 SP1Rel.
My system is a Dell Latitude M60
Operating System: Windows XP Pro SP 3
CPU: Intel Pentium M @ 1.8 Ghz
2.00 GB RAM.