Last post Oct 31, 2013 09:39 PM by Happy Chen - MSFT
Oct 29, 2013 03:37 PM|Luckbox72|LINK
We have a number of different applications based mainly on 3 distinct data backends. I was thinking about building 3 distinct dlls to use as the data source and business layer
for multiple apps, some MVC, some web forms, some windows forms. My main question is if I was to create a dll and then reference it in the projects can you change the connection at runtime or will I need to compile a version for production, one for test,
and one for development?
or is there a better way to share the data layer/ model across different applications?
Oct 29, 2013 04:18 PM|Luckbox72|LINK
One thing I have found and maybe I wont need to worry about this is. I have a few applications currently that use subsonic to create the DAL and BLL. And a few that use other methods that create DAL and BLL packages that are then referenced in web apps.
In the app.config for this project is a connection to the test environment, but when I change the connection in the web.config of the web app it seems that it takes the connection from the web.config. Is this correct?
It seems that as long as the connection string is correct in the web.config it does not seem to matter what the app.config of the class projects are that are being referenced.
Oct 30, 2013 03:28 AM|Happy Chen - MSFT|LINK
If your project is related to app.config of the class, you can only change the connection in the web.config of the web app.
Else the app.config of the class projects are that are being referenced.
I would suggest that you read the related
How to load an assembly at runtime that is located in a folder that is not the bin folder of the application
Managing Project References
Oct 31, 2013 09:59 AM|Luckbox72|LINK
So it should get the connection string values from the calling web.config file?
Oct 31, 2013 09:39 PM|Happy Chen - MSFT|LINK
Yes, you can get the connection string values from the calling web.config file.
But your calling web.config file is accessed ? all methods from the dll recieve the connection and ensure it would be used.