QQ and Reverse Relationships
The power of Qcodo's ORM is the ability not just to code generate the code to handle foreign key
relationships, but also the ability to have that code handle the "reverse" foreign key relationships.
So in the Examples Site data model, we're talking about not just a Project
and its ManagerPerson
property... but we're also talking about a Person and methods like GetProjectAsManagerArray()
also has this built-in capability, which works very similar to the way QQ
And this should make sense -- from Person's
point of view, it has a "-to-Many" relationship with Project
as a Manager
(via the reverse relationship), and it has a "-to-Many" relationship with Project
as a Team Member (via the
association table). Therefore QQ
has the ability to perform the full set of QQ
(including conditions, expansions, ordering, grouping, etc.) on tables related via these reverse relationships
just as it would on tables related via a direct foreign key or association table.
The naming standards for the relationship as well as the differences between Expand
are all the exact same as the case with association tables.
Get All People, Specifying the Project They Manage (if any), for Projects that have 'ACME' or 'WEB' in it
Notice how some people may be listed twice, if they manage more than one project.
Mike Ho (managing the "State College HR System" project)
Karen Wolfe (managing the "ACME Website1" project)
Karen Wolfe (managing the "ACME Payment s" project)
Same as above, but this time, use ExpandAsArray()
Notice how each person is only listed once... but each person has an internal/virtual _ProjectAsManagerArray which may list more than one project.
via: State College HR System
via: ACME Website1, ACME Payment s