Mike,

As far as I can follow the source code,  you need to reinitialize the
ConfigurationSourceFactory, but it seems to be initialized when the app
loads the config file at startup, so I hit a brick wall there too.

This is what I tried.

Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceFactory.Create
();
Database db = DatabaseFactory.Create("foobar");

 Didn't seem to work though :P

If it's just in the setup application could you not load the app.config file
and processes it with XmlDocument to change the config section then launch a
new instance of the application and kill the current instance?

Dave.

On 12/3/07, Mike Andrews <[EMAIL PROTECTED]> wrote:
>
> Thanks for the response Eddie.
>
> However, that's not my issue.  During my installation process, I need to
> change the connection string to point to the newly installed database.
> Then, I need to to execute some business classes that use the application
> blocks for data access.  It seems that even though I can change the config
> file and I haven't yet written any code to use the
> DatabaseFactory.CreateDatabase(...) method, it still uses the old
> connection
> string instead of the new one that I just wrote out.
>
> I'm really not sure what to do now.
>
> Thanks,
> Mike
>
> On Dec 3, 2007 9:41 AM, Eddie Lascu <[EMAIL PROTECTED]> wrote:
>
> > Before you go ahead and reveal your code, here is how I am doing it. I
> > have
> > an application and an app.config file. Inside the <configuration>
> section
> > I
> > have a section for the connection string:
> >
> > <connectionStrings>
> >   <add name="My Database Connection String"
> >
> >  connectionString="Database=MyDatabaseInstance;Server=MyDatabaseServer;
> > Integrated Security=Yes;"
> >      providerName="System.Data.SqlClient" />
> > </connectionStrings>
> >
> > Inside my application I execute this:
> >
> > SqlDatabase objDatabase_ = DatabaseFactory.CreateDatabase("My Database
> > Connection String") as SqlDatabase;
> >
> > Now, when I deploy my application, I only change the name of the
> database
> > instance and server and everything works just fine.
> >
> > HTH,
> > Eddie
> >
> >
> >
> >
> > -----Original Message-----
> > From: Discussion of advanced .NET topics.
> > [mailto:[EMAIL PROTECTED] Behalf Of Eddie Lascu
> > Sent: Saturday, December 01, 2007 5:11 PM
> > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> > Subject: Re: [ADVANCED-DOTNET] Connection strings and the MS Enterprise
> > Library Block
> >
> >
> >  Can you post some code? I have been doing the exact same thing w/o any
> > issues for the last couple of years. You must have gotten it wrong.
> >
> > ===================================
> > This list is hosted by DevelopMentor(R)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> >
> > ===================================
> > This list is hosted by DevelopMentor(R)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> >
>
> ===================================
> This list is hosted by DevelopMentor(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>



--
Dave Jones
[EMAIL PROTECTED]
[EMAIL PROTECTED]

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to