Access web.config from separate Class Library?

前端 未结 6 1352
轻奢々
轻奢々 2020-12-16 15:01

I\'m looking for a good way to achieve the following:

I have a web application (MVC 3), with a separate Class Library that contains the back-end logic of a CMS that

6条回答
  •  自闭症患者
    2020-12-16 16:01

    I'd go with something like Autofac to give you some IoC implementation which can store a settings interface for your connection strings. This would allow you to setup the value from the web.config on application start, or to set it within tests to a different value without your Class Library ever having to be coupled to a web.config.

提交回复
热议问题