-2

I have a DAL project using entity framework. I refer the project into BAL project, when i execute the BAL project. i got the error like

"No connection string named 'StudentEntities' could be found in the application config file."

Then i copied the DAL project connection string and the paste the BAL project web config.That time my error would fixed. but my question is.

We exexute the BAL, the BAl call the DAL, already DAL have connection string the why we got this error ?

Why Microsoft did like this ?

Is anything reasons ?

Note: This error discussed more times in stackoverflow but my question is different from other

venerik
  • 5,766
  • 2
  • 33
  • 43

1 Answers1

2

Because configuration is read from the config file of the entry project, which in this case BAL. Otherwise you would not be able to use your DAL project in different projects with different connection strings

yclkvnc
  • 913
  • 8
  • 15
  • but DAL only needs connection string hm – user2384352 May 16 '13 at 12:41
  • This is the correct answer. Exactly one app.config file is read - the one that corresponds to your entry project. If any of your referenced projects use settings from their own config files, then you need to copy these settings into your entry project's config. – Mike Chamberlain May 16 '13 at 12:53