We’re building a new application that needs to fetch and sync lots of it’s data with the legacy (ERP) system. Essentially it’s about orders and orderlines.
Our application is responsible for creating and updating an order in concept and when the end user is ok with it, it’ll finalize the order. The end user can take several days to finalize the order, and can save it in the meantime. Whenever the concept order is saved we need to sync it with the legacy system (we cannot do it just once before finalizing).
Whenever we sync the concept order to the legacy system, orderlines get a unique id (guid). We cannot provide our own guids, so they are created by the legacy system. When we want to update the concept order (e.g. the amount of an orderitem is changed) we need send the order(lines) with the legacy guids.
I’m wondering what’s the best way to keep track of these external id’s without taking over to much of the legacy orderline fields.
Would you make this part of your Aggregate(Member)? Would you use the external id’s as EntitiyId for an aggregate member? If so, how to handle new orderlines which do not have an id yet from the external system?