How do I load an app.config for a non exe

Posts   
 
    
tthompson4
User
Posts: 3
Joined: 20-Oct-2006
# Posted on: 20-Oct-2006 20:42:43   

I am working on creating a mmc snap in in .NET 2.0 and wanted to use LLBLGen Pro 2.0 for some database access. The problem I have is this, this project generates a dll that is loaded by mmc.exe and therefor does not load a standard app.config for the connection string. Is there a way I can programatically tell the dll where to grab the connection string from?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 21-Oct-2006 03:03:55   

Are you using Adapter or Selfservicing?

tthompson4
User
Posts: 3
Joined: 20-Oct-2006
# Posted on: 21-Oct-2006 05:50:28   

I am using self servicing.

C4 avatar
C4
User
Posts: 32
Joined: 12-Nov-2005
# Posted on: 21-Oct-2006 09:22:20   

tthompson4 wrote:

I am working on creating a mmc snap in in .NET 2.0 and wanted to use LLBLGen Pro 2.0 for some database access. The problem I have is this, this project generates a dll that is loaded by mmc.exe and therefor does not load a standard app.config for the connection string. Is there a way I can programatically tell the dll where to grab the connection string from?

If I'm not mistaken it's under <NameSpace>.HelperClasses.DBUtils.ActualConnectionString or something to that effect.

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 21-Oct-2006 15:17:54   

And you can use application settings (new feature in .net 2) to store the connection strings.

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 22-Oct-2006 00:44:22   

C4 had it right. See the documentation under "Generated code - DbUtils functionality - Connection Strings".

You could also switch to using the Adapter templates, which allows you to pass a connection string to use at runtime to the DataAccessAdapter constructor.

tthompson4
User
Posts: 3
Joined: 20-Oct-2006
# Posted on: 23-Oct-2006 18:30:23   

I've got it now I'm using Settings to store the ConnectionString and then I pass it to DbUtils.ActualConnectionString at run time. Seem to work perfectly. Thanks all.