app.config issue

K

Kele

If you are developing N-Tier applications and in your middle (Business
Logic) Tier you have a Calculate class that performs some function and it
has a app.config and an XML file. The app.config file contains the location
of the XML file and the XML file contains business information for the
class. Then you have a Web Form that uses this class which has a web.config
file.

Is there a way to tell the Calculate class to read the information in from
the app.config class at runtime rather than trying to read the information
from the web.config class? It seems silly that the Web Form should know
about the XML file.

I hope I have explained myself properly.
Cheers Kele.
 
T

Truong Hong Thi

Hi Kele,

There is only one application config (in case of web app, it is
web.config) per application domain. You can get it at
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile. Your
business logic layer is a DLL, right? Then it could not have
app.config. In fact, if you add one, VS.NET will not automatically
rename and copy it to output folder when building as it does for EXE.

Because Calculate can access web.config using System.Configurations
namesapce, so there is no need to add that app.config file which you
must manually add code to parse.

Regards,
Thi - http://thith.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top