Ever considered putting environment specific configuration in the Sitecore database? …well don’t.
In the official Mailing list module, Sitecore has, among others, placed the database connection string and we have nothing but grief from it. Consider moving from development to test to production, or in the latest example a customer wanted to have an internal test site nightly updated with the production database. Sigh!
Real Sitecore style, we’ve even looked into the possibility of hooking into the database connection of the mailing list module – but no:
- All database access in the MailingList module goes through the internal class Sitecore.Modules.MailingList.Core.SqlHelper
- This class is only accessible through the internal property SqlHelper SqlHelper in Sitecore.Modules.MailingList.Core.MailingList
- SqlHelper opens a database connection in the protected (but not virtual) IDbConnection CreateConnection()
- This function returns an SqlConnection if the Sitecore field “Database” contains the text “MSSQLSERVER” (*Sigh*), otherwise an OleDbConnection is opened
- The sql server ConnectionString is read from public static string Sitecore.Modules.MailingList.Core.MailingListSettings.ConnectionString
- This property reads the value from the field ConnectionString in the Sitecore database
As you can see there is no way of plugging in anywhere…