/// <summary> /// Creates a new instance of the <see cref="CmoService"/> class. /// </summary> public CmoService() { CPDataProvider provider = new CPDataProvider(); CPProviders.DataProvider = provider; CmoProviders.DataProvider = provider; GC.KeepAlive(provider); GC.KeepAlive(CPProviders.SettingsProvider = new CPSettingsProvider()); }
/// <summary> /// Creates a new instance of the <see cref="SecurityService"/> class. /// </summary> public SecurityService() { CPDataProvider provider = new CPDataProvider(); CPProviders.DataProvider = provider; CPSecurity.Provider = this; GC.KeepAlive(provider); GC.KeepAlive(CPProviders.SettingsProvider = new CPSettingsProvider()); }
/// <summary> /// Initializes <see cref="CPApplication"/> with an <see cref="HttpApplicationState"/>. /// </summary> /// <param name="application">The <see cref="HttpApplicationState"/> to associate with.</param> public static void Initialize(HttpApplicationState application, IDataProvider dataProvider = null, ICmoDataProvider cmoProvider = null, ISettingsProvider settingsProvider = null, ISecurityProvider securityProvider = null) { CPApplication.Application = application; CPApplication.Application[SiteUrlKey] = ConfigurationManager.AppSettings["CPSiteUrl"]; CPApplication.Application[AuditEmailKey] = ConfigurationManager.AppSettings["CPAuditEmail"]; CPApplication.Application[CsuEmailKey] = ConfigurationManager.AppSettings["CPCsuEmail"]; CPApplication.Application[GeneralEmailKey] = ConfigurationManager.AppSettings["CPGeneralEmail"]; CPApplication.Application[AuditExtensionRequestsEmailKey] = ConfigurationManager.AppSettings["CPAuditExtensionRequestsEmail"]; // initialize providers CPDataProvider defaultProvider = new CPDataProvider(); GC.KeepAlive(CPProviders.DataProvider = dataProvider ?? defaultProvider); GC.KeepAlive(CmoProviders.DataProvider = cmoProvider ?? defaultProvider); GC.KeepAlive(CPProviders.SettingsProvider = settingsProvider ?? new CPSettingsProvider()); GC.KeepAlive(CPSecurity.Provider = securityProvider ?? new SecurityProvider()); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(CampExceptionHandler.Application_ThreadException); CPDataProvider provider = new CPDataProvider(); CPProviders.DataProvider = provider; CmoProviders.DataProvider = provider; GC.KeepAlive(provider); GC.KeepAlive(CPProviders.SettingsProvider = new CPSettingsProvider()); GC.KeepAlive(CPSecurity.Provider = new SecurityProvider()); SettingsManager.Initialize(); _camp = new CampForm(); Application.Run(_camp); }