public static InitStatics ( SystemInitializer globalInitializer, string appName, bool isClientSideProgram, bool useRelativeInstallationPath = false, Func |
||
globalInitializer | SystemInitializer | The system's global initializer. Do not pass null. |
appName | string | |
isClientSideProgram | bool | |
useRelativeInstallationPath | bool | Pass true to use a relative path for the installation folder. This means that the folder will be located using /// the working directory rather than the assembly path. Use with caution. |
mainDataAccessStateGetter | Func |
A method that returns the current main data-access state whenever it is requested, including during this /// InitStatics call. Do not allow multiple threads to use the same state at the same time. If you pass null, the data-access subsystem will not be /// available in the application. |
Résultat | void |
/// <summary> /// Call this from Application_Startup. Besides this call, there should be no other code in the method. /// </summary> /// <param name="globalInitializer">The system's global initializer. Do not pass null.</param> /// <param name="appInitializer">The application initializer, which performs application-specific initialization and cleanup. If you have one of these you /// should name the class AppInitializer.</param> public static void InitStatics(SystemInitializer globalInitializer, SystemInitializer appInitializer = null) { GlobalInitializationOps.InitStatics(globalInitializer, "Application", false); if (GlobalInitializationOps.SecondaryInitFailed) { shutDown(); return; } exceptionHandlerEnabled = true; WpfInitializationOps.appInitializer = appInitializer; if (appInitializer != null) { appInitializer.InitStatics(); } }
/// <summary> /// Call this from the SetUp method in your NUnit initializer. Besides this call, there should be no other code in the method. /// </summary> /// <param name="globalInitializer">The system's global initializer. Do not pass null.</param> /// <param name="appInitializer">The application initializer, which performs unit-testing-specific initialization and cleanup. If you have one of these you /// should name the class AppInitializer.</param> public static void InitStatics(SystemInitializer globalInitializer, SystemInitializer appInitializer = null) { GlobalInitializationOps.InitStatics(globalInitializer, "Tests", false, useRelativeInstallationPath: true); try { if (GlobalInitializationOps.SecondaryInitFailed) { throw new ApplicationException( "An exception occurred during application initialization. Details should be available in an error email and the installation's error log."); } UnitTestingInitializationOps.appInitializer = appInitializer; if (appInitializer != null) { appInitializer.InitStatics(); } } catch { CleanUpStatics(); throw; } }