The main idea and reasons for this change
In short, the core idea for all these performance improvements in XAF ASP.NET WebForms apps is that under certain circumstances, we intentionally suppress creation and rendering of current web page controls, disable unnecessary data-binding operations, reduce the number of requests to the server and perform updates on the client side where possible. This enables us to produce a web app that behaves faster and is more responsive, which is especially essential for hand-held devices (e.g., tablets, smart phones) with usually weaker hardware than on PCs. Desktop web browser users also will notice these positive changes as well, especially in scenarios involving popup windows.
Since several thousand of our unit and complex functional tests have passed, these optimizations are turned on by default in XAF v16.1, so that everyone can benefit from them. Specially for backward compatibility or in the case of unhandled issues in your custom code that might occur due to these optimizations, we also provided various static options in the DevExpress.ExpressApp.Web.WebApplication.OptimizationSettings class allowing you to turn this feature off completely or partially.
Options to turn these optimizations off
At the moment of writing, the static DevExpress.ExpressApp.Web.WebApplication.OptimizationSettings class properties for controlling this behavior are:
1. AllowFastProcessListViewRecordActions - controls optimizations related to the ListViewShowObject and Edit Actions in ASPxGridListEditor. This option can influence the ListViewProcessCurrentObjectController.CustomProcessSelectedItem event. Disable this option if you face any difficulty when custom processing selected items is implemented in this event handler (e.g., difficulty with the default UI elements rendering or behavior).
2. AllowFastProcessLookupPopupWindow - controls optimizations related to opening popup windows.
3. AllowFastProcessObjectsCreationActions - controls optimizations related to the New and Link Actions by default (you can extend this for custom Actions by inheriting the DevExpress.ExpressApp.Web.SystemModule.CallbackHandlers.ActionsFastCallbackHandlerController class and overriding its RegisterFastProcessAction method). This flag is also responsible for fast opening of popup windows.
4. EnableNavigationControlDelayedCreation - controls optimizations related to the navigation control re-creation and rendering. In general, the control can be created and rendered on the server only once, unless important changes to the corresponding navigation items structure are detected. If there are no changes to the structure, all the updates in response to user actions can be performed on the client-side via JavaScript.
5. LockRecoverViewStateOnNavigationCallback - controls optimizations related to the ShowNavigationItem Action (other Actions can additionally be enabled via the ActionsFastCallbackHandlerController class as described above).
6. WebPropertyEditorOptimizeReadValue - controls optimizations to the PropertyEditor.ReadValue method calling in data item templates for our List Editors.
7. UseModelValuePersistentPathCalculatorCache - controls optimizations related to the Application Model node values calculators.
8. EnableMenuDelayedCreation (v16.1.5+) - controls optimizations related to the action container rendering for the menu systems. In general, the menu is rendered on the server when massive changes such as adding or removing action items occur. If there are no changes to the menu structure, all the updates in response to user actions can be performed on the client-side via JavaScript. For v16.1.4, use the DevExpress.ExpressApp.Web.Templates.ActionContainers.ActionContainerHolder.PartialRender option.
Note: certain options work in combination, e.g., the AllowFastProcessLookupPopupWindow and AllowFastProcessObjectsCreationActions are responsible for fast popup window opening in nested frames (if they are both set to True). So, disabling only one AllowFastProcessObjectsCreationActions will disable the popup optimization completely.
What can I do in case of potential problems?
If you experience any unexpected display or rendering issues for controls, JavaScript errors or even some server-side code suddenly stopped working (even though is executed properly in previous XAF versions) with the v16.1 update, first try to set the aforementioned static options to False in the Application_Start method of the YourSolutionName.Web/Global.asax.xx file to get your application working again. Here is an example for the XCRM.Web app:
C#//XCRM.Web\Global.asax.cs
...
namespace XCRM.Web {
public class Global : System.Web.HttpApplication {
protected void Application_Start(object sender, EventArgs e) {
DevExpress.ExpressApp.Web.WebApplication.OptimizationSettings.AllowFastProcessListViewRecordActions = false;
...
}
Regardless of whether this action helps you or not, be sure to contact our support team via the https://www.devexpress.com/Support/Center/Question/Create service and attach your problematic sample, use-case scenario description or any other supporting information that will help us replicate and research the connection of your project behavior to the aforementioned improvements and suggest the best technical solution.
If the issue occurs only in a specific view, and disabling an optimization as described above helps, you can avoid the issue in this view without losing speed improvements in other scenarios by disabling the corresponding controller. For example, if you customized the default list view action and faced an issue related to our performance optimizations, you can disable ListViewFastCallbackHandlerController instead of setting the AllowFastProcessListViewRecordActions option to False:
C#public class MyControllerWeb : MyController {
DevExpress.ExpressApp.Web.SystemModule.CallbackHandlers.ListViewFastCallbackHandlerController listController;
protected override void OnActivated() {
base.OnActivated();
listController = Frame.GetController<DevExpress.ExpressApp.Web.SystemModule.CallbackHandlers.ListViewFastCallbackHandlerController>();
if (listController != null) {
listController.Active.SetItemValue("Optimize", false);
}
}
protected override void OnDeactivated() {
base.OnDeactivated();
if (listController != null) {
listController.Active.SetItemValue("Optimize", true);
}
}
}
The DevExpress.ExpressApp.Web.SystemModule.CallbackHandlers.ActionsFastCallbackHandlerController can be disabled in a similar manner if you have issues with the New, Edit or Link action customizations.