To some extent, it can be called the relationship between tables.
The persistent classes of xpo support complete inheritance and polymorphism.
For example, a manager is an employee, but an employee is not necessarily a manager. In the previous database design, we can add a management personnel identifier in the employee table, or create another management personnel table, and then use the foreign key to establish a relationship with the employee table.
In xpo, you can use OO to describe the relationship: Create an employee class, and then create a subclass of the employee class: Administrator class.
Public class employee
Inherits xpobject
Public lastname as string = ""
Public firstname as string = ""
<Association ("manageremployees")> Public Manager as manager = nothing
Public sub new ()
End sub 'new
Public sub new (byval newlastname as string, byval newfirstname as string)
Lastname = newlastname
Firstname = newfirstname
End sub 'new
End Class 'employee
_
Public class Manager
Inherits employee
<Association ("manageremployees", GetType (employee)> _
Public readonly property employees () as xpcollection
Get
Return getcollection ("employees ")
End get
End Property
Public sub new ()
End sub 'new
Public sub new (byval newlastname as string, byval newfirstname as string)
Mybase. New (newlastname, newfirstname)
End sub 'new
End Class 'manager
Note that the association attribute is used. However, the association here only indicates the subordinate employees (Management Personnel) managed by a manager ).