I wasn't sure where to put this question.
I have an Order table and an OrderLineItems table. OrderLineItems has a FK relationship to the PK of the Order table.
Currently, when an order is being updated this is the process:
- Delete all the OrderLineItems from the database, with the adapter.DeleteEntityDirectly().
- Add new OrderLineItems to the Order.OrderLineItems collections.
- Save the updated Order, with adapter.SaveEntity();
- Save the OrderLineItems with adapter.SaveEntityCollection(Order.OrderLineItems);
I know there is a better way to do this, but perhaps I'm not seeing it?
Although I do have a PK on the OrderLineItems table the system I am synchronizing with (quickbooks) does not, so I have no way to tell if a particular LineItem has been updated or if it's an entirely new lineitem. This is why I delete everything first then re-add it.
Has anyone had a similar problem/solution?