亚音速 3 类库和Winforms 应用程序 Null IDataProvider BUG
我有一个类库项目和一个 winforms 应用程序。
一切都进展顺利,我的 Winforms 应用程序引用了类库,但是一旦我运行它并尝试检索数据,它就会出现 dataprovider 为空。
需要注意的一件事是,我的 Winforms 应用程序中没有 app.config,仅在类库中。我是否需要在 Winforms 应用程序中添加一个,如果需要,我应该在其中放入什么?
谢谢
更新:我想我在 Query\Select.cs 中发现了一个错误
public Select(IDataProvider provider, params string[] columns)
{
//_provider is null
//provider is populated correctly
this.sqlFragment = new SqlFragment(_provider);
_provider = provider;
SelectColumnList = columns;
SQLCommand = this.sqlFragment.SELECT;
}
I have got a class library project and a winforms app.
Everything is getting geerated fine and my Winforms app references the class library but as soon as I run it and try to retreive data it comes up with dataprovider is null.
The one thing to note is that I do not have a app.config in my Winforms app only in the class library. Do I need one in the Winforms app and if so what do I put in it?
Thanks
UPDATE: I think I have found a bug in Query\Select.cs
public Select(IDataProvider provider, params string[] columns)
{
//_provider is null
//provider is populated correctly
this.sqlFragment = new SqlFragment(_provider);
_provider = provider;
SelectColumnList = columns;
SQLCommand = this.sqlFragment.SELECT;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您的 Winforms 应用程序中需要一个 App.config,并将连接字符串放在那里。值得注意的是,App.config 在类库中毫无意义,除非您使用 SubSonic :),它将从项目中提取一个。
类库没有自己的配置 - 它们从执行环境中提取配置。
Yes, you need an App.config in your Winforms app and you put your connection string there. It's worth noting that an App.config is pointless in a class library EXCEPT when you're using SubSonic :), which will pull one from the project.
Class libraries don't have their own configuration - they pull their config from the execution environment.