Criteria for object datasources to display in Visual Studio Report New DataSet?
Asked Answered
H

0

3

In the "Report Data"..."New Dataset" dialog, I only have about 5 classes. None of my main business classes are showing up. Some that do show up don't show and properties. Some that show up are generic and there is not much point even showing these. e.g. SortedListBase<T> : SortedKeyedCollection<int, T> where T : IdEntity with two public static methods:

public static SortedListBase<T> Build(string StoredProc, CTorDelegate CTorDelegate, Action<SqlCommand> AddParameters)

public static SortedListBase<T> Build(string StoredProc, CTorDelegate CTorDelegate)

which show up as:

SortedListBase`1 (Build)
SortedListBase`1 (Build)

And neither of which can actually do anything since they are completely generic.

Most of my classes have private constructors and this appears to be something which may be stopping them from showing up. The classes usually have static methods which return the collections, and private constructors and static factory methods. I made a test class which shows up (it returns null as a List), and then I went and added a private parameterless constructor (it had no explicit constructor when I created it) and bam - it disappeared.

I guess it's because I tend to use fewer classes - I just have the instance methods (for actions, properties, etc) and static methods (for lists and factories) in the same class? Do most people put their object list methods in its own class which has a public constructor?

Are classes with private constructors not able to be added? If so, is the best thing to simply make dummy classes which you bind to at design-time and then at runtime point to the method which does actual work and returns a real List?

Humism answered 18/9, 2011 at 4:45 Comment(2)
I don't think it is because you have fewer classes. I usually put my methods and properties within the same class with a public constructor and I still see the same problem. Have you been able to solve it?Mullis
@shruhash21 I don't remember how I worked around the problem. This was almost 3 years ago. But the problem is that only classes with public parameterless constructors will show up in the list.Humism

© 2022 - 2024 — McMap. All rights reserved.