I have an Invoice object wich may contain several FacturedServices objects stord as a list.
In may interface, the user can edit an Invoice object, delete add or edit its FacturedServices list.
Whe the user hit the save button, the updates made to Invoice object should be passed to the database as well.
The problem is the FacturedServices list will contain heterogenous data, because some of its elements are new, others changed and some of them have been deleted from the list.
What is the best way to implement hte update of the Invoice object in the database ?
I was thinking to add a dirty property on every FacturedService object, whenever it is changed, or set the property to "new" when its newely created and then do some if else in my controller :\
If you think my question should be rephrased, please do it
EDIT : Say I have an object Invoice I , It has 3 FacturedServices FS1, FS2, FS3
In the interface, the user edited FS1, deleted FS2, and added FS4 to the list
now the list contains edited FS1, unchanged FS3 and newly created FS4.
in my databse, I have an InvoiceTable and a FactureServicesTable whith a referencial inetgrety to the invoice id.
my problem is in my controller there must be a way to know which FS is new which one is updated and which one was deleted, so I can execute the correct SQL commands depending on the situation.
I know this is not something new, in every desktop application at some point there should be something similar to my problem. so what is the best way to do this.