【发布时间】:2010-11-06 22:31:34
【问题描述】:
我目前面临关于 Subsonic 配置的问题。
我想要实现的是在 System.Web.UI.Design.ControlDesigner 类中使用亚音速数据访问。
此类托管在 Visual Studio 环境中,并在附加的 System.Web.UI.WebControls.Control 上启用设计时操作。
唯一的问题是 SubSonic 似乎总是在应用程序配置中寻找 SubSonicSection,无论是否将连接字符串传递给它。
相关代码sn-p:
using (SharedDbConnectionScope dbScope = new SharedDbConnectionScope(new SqlDataProvider(), ConnectionString))
{
Table1 _table1 = new Select().From<..().Where(...).IsEqualTo(...).ExecuteSingle<...>();
ExecuteSingle() 方法抛出异常(未找到配置部分)
同时
using (SharedDbConnectionScope dbScope = new SharedDbConnectionScope(ConnectionString))
{
在新的 SharedDbConnectionScope() 上抛出异常(未找到配置部分)
所以问题是:
有什么方法可以通过设置运行时绕过配置部分查找,因为我不想将任何亚音速特定配置添加到 devenv.configuration
谢谢
【问题讨论】:
标签: c# visual-studio subsonic app-config