CSLA and deferred undo

CSLA and deferred undo

Old forum URL: forums.lhotka.net/forums/t/1628.aspx


KPrasadKhan posted on Monday, October 30, 2006

Hello,

I have been developing business applications for quite a long time. Most of which belong to either the banking industry or insurance industry. Since data security in these applications is of utmost importance, these applications tends to have a maker checker concept to ensure that there is a tight control in master setups. The schem works as follows.

I am not sure whether this kind of requirement is satisfied by the CSLA framework and if yes how.

Regards,

Prasad P. Khandekar

Bayu replied on Monday, October 30, 2006

Hi,

The undo capabilities of CSLA or strictly intended for use within the application lifetime. So while users edit an object they can hit escape and 'undo' the edits and revert to the original values.

The framework does not inherently support undo after an object has been persisted to a DB (at leat not without modification/customization on your part).

However, giving it a short thought I think it wouldn't be too hard to implement:
- create 2 tables in you DB:
    - one with the yet unchecked modifications that still need to be approved
    - one with the approved changes
- the process of 'making' would create new entries in the former table
- the same holds true for modifications made to existing records, this would involve making a copy from the 'approved' table and then storing the modified version in the 'to approve' table
- the process of 'checking' would become a specific use-case where a record gets copied to from the former table to the latter

Disadvantages:
- duplicate table structure, thus duplicate maintenance
- specific persistency logic (CRUD operations get different interpretations then usual)

Advantages:
- clarity, the not-yet-approved items are isolated in a separate table
- the remainder of your relational model will only have relations to the 'approved' table

Alternative:
- add a boolean column which holds the 'checked' (true/false) value. In your CRUD operations you set the value accordingly. The key disadvantage here is that you can never ensure that unchecked records are NOT referenced in relations to other tables.

Regards,
Bayu



Copyright (c) Marimer LLC