| 
0
 | 
     1 <% title # EditableObject class %>
 | 
| 
 | 
     2 <% order # 1 %>
 | 
| 
 | 
     3 <p class="j">
 | 
| 
 | 
     4 <b>EditableObject</b> is an object that provides functionality to commit and rollback changes to itself.
 | 
| 
 | 
     5 After verifying the accuracy of changes made to the object, you can accept the changes
 | 
| 
 | 
     6 using the <b>AcceptChanges</b> method of the object, which will set the <b>Current</b> field values
 | 
| 
 | 
     7 to be the <b>Original</b> values. The <b>RejectChanges</b> method rejects all changes made to the object
 | 
| 
 | 
     8 since <b>AcceptChanges</b> was last called. The <b>IsDirty</b> property gets a value that indicates
 | 
| 
 | 
     9 whether the object has changed.
 | 
| 
 | 
    10 </p>
 | 
| 
 | 
    11 <p class="j">
 | 
| 
 | 
    12 If we wrote an editable object manually, we could get the following code just for two editable properties:
 | 
| 
 | 
    13 </p>
 | 
| 
 | 
    14 <% Doc\EditableObjects\ManualEditableObject.cs %>
 | 
| 
 | 
    15 
 | 
| 
 | 
    16 <p class='j'>
 | 
| 
 | 
    17 BLToolkit allows implementing the same functionality by inheriting your object
 | 
| 
 | 
    18 from the BLToolkit <b>EditableObject</b> base class and replacing editable members with abstract properties.
 | 
| 
 | 
    19 </p>
 | 
| 
 | 
    20 EditableObjectTest.cs
 | 
| 
 | 
    21 <% ..\..\..\HowTo\EditableObjects\EditableObjectTest.cs %>
 | 
| 
 | 
    22 
 | 
| 
 | 
    23 <p class='j'>
 | 
| 
 | 
    24 BLToolkit type builder will generate the following for the class above:
 | 
| 
 | 
    25 </p>
 | 
| 
 | 
    26 <% Doc\EditableObjects\EditableObject.cs %>
 |