Open jvdonkoec opened 9 years ago
This is what we have done in the past:
// Read the module Web.Config
var fileMap = new ExeConfigurationFileMap {
ExeConfigFilename = HostingEnvironment.MapPath("~/Modules/MyCustomModule/web.config")
};
var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
var appSettings = configuration.AppSettings.Settings;
I'm upgrading an Orchard website from 1.8.1 to 1.9.1 including some custom modules which use Entity Framework to access legacy databases(using the Firebird Db provider).
Entity Framework requires some settings in the web.config but it seems it can't find those settings anymore. These settings were located in the module root Web.Config file. If I move these settings to the Orchard.Web Web.config file it can find them and the legacy databases can be accessed. But, I want to keep these Entity Framework settings as close as possible the the module which uses it.
The settings needed by Entity Framework, one element in the top and 2 in the bottom area of the modules Web.Config file:
The error thrown when it can't find the settings: