C# – subsonic in visual studio design host

app-configcsubsonicvisual studio

I'm facing currently a problem regarding Subsonic configuration.

What I want to achieve is using subsonic data access in a System.Web.UI.Design.ControlDesigner class.

This class is hosted in Visual Studio Environment and enables design time operations on the attached System.Web.UI.WebControls.Control.

The only problem is SubSonic seems always looking for SubSonicSection in the application configuration regardless passing connection string to it.

The relevant code snippet:

using (SharedDbConnectionScope dbScope = new SharedDbConnectionScope(new SqlDataProvider(), ConnectionString))
{
Table1 _table1 = new Select().From<..().Where(...).IsEqualTo(...).ExecuteSingle<...>();

Throws exception on ExecuteSingle() method (configuration section was not found)

while

using (SharedDbConnectionScope dbScope = new SharedDbConnectionScope(ConnectionString))
{

Throws exception on new SharedDbConnectionScope() (configuration section was not found)

So the question is:
Is there any way to pass the settings runtime to bypass the configuration section lookup as I don't want to add any subsonic specific configuration to devenv.configuration

Thanks

Best Answer

I don't think you can do this in 2.x without customising the templates (which can obviously give support issues when a newer version of SubSonic is released).

Sorry, don't know about 3.0