Short question:
What is best practice when working offline with SQL Azure DB tables where inserts are required?
Long question plus detail:
I am developing an app for taking menu orders. The tables are OrderHeader, OrderDetail, MenuCategory and MenuItem. The database is an Azure SQL DB.
MenuCategory and MenuItem will not be updated by the user of the menu app, so I have already set these to cache locally when the app is started. This has improved performance significantly (e.g. when selecting from the menu category gallery, the associated menu items populate almost immediately in their gallery rather than a 3 or 4 second delay).
I would now like to have OrderHeader and OrderDetail work offline, but the user must be able to add new records to these tables and these must later be saved to Azure SQL DB. The purpose of making these offline is to improve performance and to allow the app to be used in the event of a connectivity failure. I would have the app write any cached data back to the Azure SQL DB either on a timer or on the event of an order being paid.
Both tables currently have primary keys that are identity fields (incrementing by 1 for each new record). OrderDetail includes a foreign key to OrderHeaderID in the OrderHeader table. Typically a user will create a new OrderHeader record then a number of associated OrderDetail records.
What is best practice when working offline with tables where inserts are required, especially where one table must reference data inserted in another table? If I change Identity to GUID, will PowerApps be able to generate the GUIDs while working in offline mode? I would prefer not to use a composite ID both for clarity and because I understand PowerApps will not check for uniqueness in a composite key when working offline.
Thanks
Paul