I'm trying to figure out how to do a simple one-to-one relationship with PetaPoco in Umbraco 7.
The ideal solution would be for my Peta object to contain a definition for another Peta model, which will be eager loaded when the object is instantiated. Etc. i have two Petas
Country and Sport. The sport peta has a country_id column. When i instantiate the sport object i would like to be able to do a:
SportPeta.Country.Name;
Instad of having to either "Select the sport Peta with a join clause" or running multiple selects.
Is this merely possible?
Thanks in advance Jonas
PetaPoco it's a microORM and doesn't do this automatically, you have to do it yourself using a property getter.
But, keep in mind that having this kind of lazy loading properties can fire lot's of DB calls without you even knowing.
My recommendation is having a ResultColumn for the really common join properties, like country name, and populate it using a SQL join