ConnectionString from app.config

Posts   
 
    
astrnad
User
Posts: 30
Joined: 23-Jul-2007
# Posted on: 06-Aug-2007 13:30:52   

Version: LLBL Gen Pro v2.0.0.0 Final SelfServicing Templates

Hello all,

This might be a newbie question, but i couldn't find an appropriate answer yet.. When compiling the generated sourcecode and importing the DLL's as a DataAccessLayer into a GUI Project for example, is there any way to include the actual connection string in the app.config that is already in the generated source code and not having to set the connection string in the GUI code? Everytime i am trying to use the DataAccessLayer DLL in any GUI project, i have to set the connection string again and again in the local app.config. It would come in handy to have the possibility to set the connection string in an app.config in a DLL which uses the generated code DLL and then import this intermediate DLL into some GUI project.

Regards, Alex

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Aug-2007 04:53:58   

Hi Alex. I see a few options:

A. Separate your app.config or web.config in a special folder for copy-paste in new projects.

B. Create a basic project with the .config file. Then in VSNet create a New Project based on existing one (the one who contains the .config).

C. Create a new Visual Studio Project Template or modify existing which will include the .config you want.

D. Create a new LLBLGenPro Template for your GUI project that include the .config file. You can download LLBLGenPro GUI Templates and see how this can be achieved.

The thing is that something .config files are complex and maybe contains special information regarding to application. So is good LLBLGenPro don't do these stuff for us, as it may be intrusive.

David Elizondo | LLBLGen Support Team
astrnad
User
Posts: 30
Joined: 23-Jul-2007
# Posted on: 07-Aug-2007 09:27:08   

daelmo wrote:

Hi Alex. I see a few options:

A. Separate your app.config or web.config in a special folder for copy-paste in new projects.

B. Create a basic project with the .config file. Then in VSNet create a New Project based on existing one (the one who contains the .config).

C. Create a new Visual Studio Project Template or modify existing which will include the .config you want.

D. Create a new LLBLGenPro Template for your GUI project that include the .config file. You can download LLBLGenPro GUI Templates and see how this can be achieved.

The thing is that something .config files are complex and maybe contains special information regarding to application. So is good LLBLGenPro don't do these stuff for us, as it may be intrusive.

Ok, so i have to set the connection string somehow for each application i create that bases on the DAL created. But what about using .NET code in COM objects? We have some projects that require us to compile COM DLLs and use them in other pieces of software - how do i set the connection string there without having to use DbUtils.ActualConnectionString?

Regards, Alex

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 07-Aug-2007 10:16:45   

Isn't it then better to use adapter and pass the connection string to the adapter using the adapter CTor ? Also to prevent issues with SLA vs. MLA threaded COM hosts?

Frans Bouma | Lead developer LLBLGen Pro