在 Visual Studio 报表中显示对象数据源的标准 新数据集?
在“报告数据”...“新数据集”对话框中,我只有大约 5 个类。我的主要商务课程都没有出现。一些确实出现的不显示和属性。有些显示的是通用的,甚至显示这些也没有多大意义。例如SortedListBase
有两个公共静态方法:
public static SortedListBase<T> Build(string StoredProc, CTorDelegate CTorDelegate, Action<SqlCommand> AddParameters)
public static SortedListBase<T> Build(string StoredProc, CTorDelegate CTorDelegate)
显示为:
SortedListBase`1 (Build)
SortedListBase`1 (Build)
并且它们实际上都不能做任何事情,因为它们是完全通用的。
我的大多数类都有私有构造函数,这似乎可能会阻止它们出现。这些类通常具有返回集合的静态方法、私有构造函数和静态工厂方法。我创建了一个显示的测试类(它返回 null 作为列表),然后我添加了一个私有无参数构造函数(当我创建它时它没有显式构造函数),然后砰的一声 - 它消失了。
我想这是因为我倾向于使用更少的类 - 我只是在同一个类中拥有实例方法(用于操作、属性等)和静态方法(用于列表和工厂)?大多数人是否将对象列表方法放在具有公共构造函数的自己的类中?
是否无法添加具有私有构造函数的类?如果是这样,最好的办法是简单地创建在设计时绑定的虚拟类,然后在运行时指向实际工作并返回真实列表的方法?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论