Manages the Application Model cache designed to improve the startup speed and performance.
You can customize the ModelCacheManager behavior using the following static fields.
|ModelCacheManager.UseMultithreadedLoading||Enables multi-thread loading of the Application Model cache.|
|ModelCacheManager.SkipEmptyNodes||Enables skipping empty nodes when creating and loading the Application Model cache.|
Setting both these fields to true may reduce the application startup time when the Application Model cache is enabled (see XafApplication.EnableModelCache). As these fields are static, you can access them from any code location that is executed before the Application Model cache is accessed:
- in the constructor of your platform-agnostic module located in the Module.cs (Module.vb) file;
- in the constructor of your application located in the WinApplication.cs (WinApplication.vb) or WebApplication.cs (WebApplication.vb) file;
- in the Main method of the WinForms application located in the Program.cs (Program.vb) file, before the WinApplication.Start call;
- in the Application_Start method of the ASP.NET application located in the Global.asax.cs (Global.asax.vb) file, before the WebApplication.Start call.
If SkipEmptyNodes is enabled and there is a custom Node Generator or Generator Updater which can create empty nodes, these nodes will not be cached and will not be restored from cache. You will need to override the UpdateCachedNodes method of your Node Generator, or UpdateCachedNode of your Generator Updater to recreate these empty nodes when the Application Model is being loaded from the cache.
For deeper customizations, inherit this class, handle the XafApplication.CreateCustomModelCacheManager event and pass your custom ModelCacheManager descendant to the CreateCustomModelCacheManagerEventArgs.ModelCacheManager parameter. An example is provided in the XafApplication.CreateCustomModelCacheManager event description.