Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Settings.settings file with settings for multiple regions

Reply
Thread Tools

Settings.settings file with settings for multiple regions

 
 
donet programmer
Guest
Posts: n/a
 
      11-19-2009
I thought of using Settings.settings feature that is new to .NET for
storing connection strings info for TEST, INT and PROD regions.
Currently we prefix the appSettings keys with TEST, INT and PROD in
web.config (or app.config). For instance in my web.config I have
following keys:

<appSettings>
<add key="TEST.Connection" value = "......" />
<add key="INT.Connection" value = "......" />
<add key="PROD.Connection" value = "......" />
</appSettings>

When we deploy application to each region we set the value of server
variable ENVIRONMENT to "TEST", "INT" and "PROD".

We then use following to get conn string :

string connstring = [AppSettingsReader obj].GetValue( ENVIRONMENT +
".Connection")

This gives us TEST connection string in TEST region, INT conn string
in INT region etc.

I would like to do something similar with Settings.settings file. Any
ideas.


 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      11-19-2009
donet programmer <> wrote in news:e1d08968-9837-44b1-
a00d-:

> I thought of using Settings.settings feature that is new to .NET for
> storing connection strings info for TEST, INT and PROD regions.
> Currently we prefix the appSettings keys with TEST, INT and PROD in
> web.config (or app.config). For instance in my web.config I have
> following keys:
>
> <appSettings>
> <add key="TEST.Connection" value = "......" />
> <add key="INT.Connection" value = "......" />
> <add key="PROD.Connection" value = "......" />
> </appSettings>
>
> When we deploy application to each region we set the value of server
> variable ENVIRONMENT to "TEST", "INT" and "PROD".
>
> We then use following to get conn string :
>
> string connstring = [AppSettingsReader obj].GetValue( ENVIRONMENT +
> ".Connection")
>
> This gives us TEST connection string in TEST region, INT conn string
> in INT region etc.


You don't want to do this going forward, or at least it is not likely
you want to continue this direction. In .NET 4.0 (release 1Q 2010),
there are provisions for altering a config file on deploy, so there is
no reason to consider this form of change for common config settings.

As .NET 4.0 is Go Live now, you might consider looking at the impact up
"upgrading" on your project and switching. No, I would not normally
suggest going into a beta cycle, but your needs match what they are
doing now. And the release is not that far away. And the Go Live means
Microsoft has guaranteed an upgrade path for beta 2.

Peace and Grace,
Greg



--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
 
donet programmer
Guest
Posts: n/a
 
      11-19-2009
Thanks greg for the info. We currently use .NET 3.0 which we only
recently switched to so no idea how long till we use .NET 4.0.

I was able to resolve the issue and able to store multiple sets of
values in my app.config file and still use intellisense to get its
value. For those interested I am attaching the link below :

http://blogs.msdn.com/johan_stenberg...11/491998.aspx

Thanks
 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      11-20-2009
donet programmer <> wrote in news:e65c8ba0-77bb-463f-
99e3-:

> Thanks greg for the info. We currently use .NET 3.0 which we only
> recently switched to so no idea how long till we use .NET 4.0.
>
> I was able to resolve the issue and able to store multiple sets of
> values in my app.config file and still use intellisense to get its
> value. For those interested I am attaching the link below :
>
> http://blogs.msdn.com/johan_stenberg...11/491998.aspx


That is good info. If you get a chance, look at what .NET 4.0 is doing,
however, and abstract in a similar manner. It will make it easy to switch.

Peace and Grace,
Greg

--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Panasonic NV-VP33 and NV-VP60 DVD-players and multiple Regions, andanother matter related to playing 'home-made' discs Ken DVD Video 3 09-03-2009 06:46 PM
Click multiple regions on a map Jerry Manner HTML 3 06-29-2005 01:11 AM
Config of a web app for multiple regions. Bliss ASP .Net 0 10-26-2004 03:21 AM
Hiding Regions - Alternatives Doug ASP .Net 1 08-03-2004 11:47 AM
Paste from Excel into predefined regions in HTML Humvee HTML 1 07-22-2003 02:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57