Ronald,
Yes, you would have a separate app.config file for each feed lot.
That's the whole point, this is where you would differentiate in the
settings. Basically, your configuration file would look like this:
<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot1" />
</appSettings>
</configuration>
At another feed lot, you would have:
<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot2" />
</appSettings>
</configuration>
And so on. Granted, you could write a configuration section handler,
but for something like this, this would do just fine, I think.
Then, to access these values in code:
// Get the "SomeKey" value:
string someKeyValue = ConfigurationManager.AppSettings["SomeKey"];
This will require a reference to System.Configuration.dll and this .NET
2.0-specific. In .NET 1.1 and before, you can do the same thing in the
app.config file but use this:
// Get the "SomeKey" value:
string someKeyValue = ConfigurationSettings.AppSettings["SomeKey"];
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"Ronald S. Cook" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> But the same app is installed at 12 sites and each site's specific values
> must be retrieved and used. I wouldn't think we'd maintain a separate
> app.config for each feedlot. Or should we?
>
> Thanks,
> Ron
>
>
> "Nicholas Paldino [.NET/C# MVP]" <(E-Mail Removed)> wrote
> in message news:%(E-Mail Removed)...
>> Ron,
>>
>> The app.config file is exactly what you should be doing. You can set
>> the values you need in the app.config file, and then read them easily.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - (E-Mail Removed)
>>
>> "Ronald S. Cook" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> We have a .NET Win app that runs at 12 different cattle feeding lots.
>>> Each lot runs an isolated instance of our app using its own SQL Server
>>> instance.
>>>
>>> For overall settings specific to a feedlot, we're maintaining those
>>> values right now in the database. But I'm not sure its the best way to
>>> do it. You see, we have a table "tblFeedlot" with about 20 columns BUT
>>> then only one record in the table.
>>>
>>> I thought maybe the table should have just two columns "Name" and
>>> "Value" to and have 20 records, but then the datatype would have to be
>>> varchar(100) I suppose and we'd have to d alot of validating/converting.
>>> But maybe this is the better way to go?
>>>
>>> Or do you recommend another way? Would there be some sort of app.config
>>> specific to each feedlot that we stored somewhere?
>>>
>>> Thanks,
>>> Ron
>>>
>>
>>
>
>