Hi, This may be a little naive but I just want check my way of doing this is correct. I receive a collection of objects from the UI. I then wish to check those objects against the records in the db.
This is what I am doing to Create Update and Delete the received objects.
- Loop trough received objects - if (id == 0 ) create new record.
- Retrieve existing records from db;
- Loop existing records - Where (existing record id == recieved object id) Update record.
- If the record exists in the existing records but not in the received objects - Delete.
This seems the most logical way to do this. I am using NHibernate and was kind of wondering whether there was another way I should be looking into. Any help much appreciated.