List Info

Thread: Re: Connection strings and the MS Enterprise Library Block




Re: Connection strings and the MS Enterprise Library Block
country flaguser name
United States
2007-12-01 16:10:42
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Ū  http://www.develop.com

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


Re: Connection strings and the MS Enterprise Library Block
user name
2007-12-03 10:39:32
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 <elascuibigroup.com> 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=My
DatabaseServer;
> 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:ADVANCED-DOTNETDISCUSS.DEVELOP.COM]On
Behalf Of Eddie Lascu
> Sent: Saturday, December 01, 2007 5:11 PM
> To: ADVANCED-DOTNETDISCUSS.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Ū  http://www.develop.com

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


Re: Connection strings and the MS Enterprise Library Block
user name
2007-12-03 12:33:15
It's actually an assembly I'm using with an inherited
System.Configuration.Install.Installer class and overriding
the Install(...)
method.
I'm wondering if I could load a new instance of the same
assembly in another
portion of the AppDomain and then that instance would use
the new file.
At this point I'm up for trying anything.

Thanks,
Mike
On Dec 3, 2007 11:59 AM, Davy J <djones147gmail.com> wrote:

> 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.C
onfigurationSourceFactory.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.configfile
> 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 <outdoor.jellyrollgmail.com> 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 <elascuibigroup.com> 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=My
DatabaseServer;
> > > 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:ADVANCED-DOTNETDISCUSS.DEVELOP.COM]On
Behalf Of Eddie Lascu
> > > Sent: Saturday, December 01, 2007 5:11 PM
> > > To: ADVANCED-DOTNETDISCUSS.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
> djones147gmail.com
> jones.dsfeir.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Ū  http://www.develop.com

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


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )