Database connectivity & utility classes can be provided in your Page Template by having them set as properties. They are then accessible to your code-behind classes. Initialization of these properties can be done in the OnLoad(). Alternatively, you can provide methods to initialize them in your Page Template class. These methods can then be called from the code-behind.
Advantages
- Ensures that all developers in the team use features like connection strings, utility classes, loggers, data access objects consistently.
- Initialization of these utility classes can also be done in the template providing lesser room for inconsistency.
- Since all developers have to access the utility classes via the template, it ensures that integration headaches are minimized.
- Ensures that there can be no goof ups arising out of mismatches or incorrect connection strings, log file names, email ids, etc.