This example demonstrates how to implement the following behavior (which is default in Microsoft Outlook) in XAF Windows Forms applications:
- A user can create a new record, and when its detail form is opened he or she may close the form without entering any data (e.g., a new record was created by accident). In this case, the form can be closed without any save confirmation, because no user data needs to be saved.
- If a user enters some data into the form and then closes it, the save confirmation appears as expected not to lose entered data.
To test it, run functional tests from the E2114.EasyTests\E2114.ets folder.
Steps to implement
Copy the WinSolution.Module.Win\SuppressConfirmationForNewObjectsDetailViewController.xx file into YourSolutionName.Module.Win project.
Your feedback is needed!
We are hesitating to include the current implementation by default, because there are many ways to instantiate new objects in Views and it many cases it is difficult to uniquely state that an object is "untouched". For instance, you may have custom initialization code in the AfterConstruction or OnActivated methods of your business class or Controller, in the ObjectCreating, CustomCloneObject, ActionBase's Execute or other event handlers of standard and custom XAF UI entities.
You and other readers can help us decide faster if you share your thoughts on whether this logic should cover any internal programmatic changes to objects (including Actions!) or should only consider a user touching data editors by hand. Thanks in advance.