Guids as PK and FK fields on records
Sorry, I posted this in a reply to another thread too...
Hello,
Hoping I can ask a tech question here regarding Guids as record IDs.
I have created a small proj. with 5 tables, 3 main tables and 2 association tables. Trying to handle many-to-many relationships using your framework.
All was great using int types for PK and FK fields. Works perfectly.
I changed to Guid using string as the field type and manually generating the Guid before setting the ID and inserting record into the db.
Single records work, great.
UpdateWithChildren and GetAllWithChildren and GetWithChildren break.
Is there any guidance on many-to-many relationships AND using Guid (strings) as ID field?
Do I need to handle the association records directly, ie: manually set the FKs (and maybe have a PK) on the association table?
Eventually, I will sync this with the Azure App Service and Easy Tables so some guidance there would be great too.
All help/suggestions welcome.
Anyone?
Thanks
It should work out-of-the-box. We have tests checking
Guid
primary keys. Make sure that your foreign keys are alsoGuid
and not integer type. Sometimes the error message is descriptive enough.