-
Hi, i was wondering if you have got something for identity replacement if the primary key is based on an integer? Let's say i have 1 main database and 2 tablets that work disconnected. But users do need to be able to insert records locally on their tablets. These include tables with "linked" sub tables. But i can then happen that they both create rows with the same primary key value. Is there something for this? The easiest way would be to switch to a GUID as primary key, but in my situation that is not possible since i can't change the primary key type in the database. Regards |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 3 replies
-
So, when you mention tables, are you referring to an offline database that requires synchronization? If that's the case, you'll need a database structure like this: Main Table:
If you're using our library, I suggest creating a view or a custom fetcher where you can alias the For Example (if I did it like my own way) - To retrieve data from the main table, follow these steps: Fetch the following:
Tip: I recommend you filtering this out by implementing your own fetcher for main table only. For the offline database (assuming it's a tablet):
By doing this, you'll essentially create a list of two data contracts for comparison, which is the primary focus of this library. For Refs - GlobalHelper.cs |
Beta Was this translation helpful? Give feedback.
-
Hi! sorry something went wrong with the emails from github so i totally missed your answer. Yes what is was talking about was the / an offline database. Like in a Order <> OrderLine table setup. Where the OrderLine table has got a fk_Order_ID column, which references a row in the Order table. I am trying to understand your explanation though :-) What you are saying is create an extra set of ID and fk_Order_ID columns? But how would that work in the central database if we would use multiple tablets? Since multiple tablets can insert OrderLine rows with the same ref_id's? |
Beta Was this translation helpful? Give feedback.
-
@percramer Picture this: Every offline database is assigned a unique ID, much like a |
Beta Was this translation helpful? Give feedback.
@percramer Picture this: Every offline database is assigned a unique ID, much like a
GUID
. ThisID
remains attached to the database unless it's intentionally wiped or reset or it can be associated with user login. With this in mind, you can effortlessly combine thisGUID
along with the regularID
andref_id
to construct a composite foreign key. This combination ensures proper linkage and integrity between the data across your tables.