Files to look at:

How to create persistent classes mapped to tables with a composite primary key at runtime

When you have a table with a composite key, the standard solution to map an XPO persistent class to it is to declare a structure for the key member as described in the How to create a persistent object for a database table with a compound key article. If the database schema is not known as design time, and you need to create persistent classes at runtime, the built-in XPDictionary methods won't help, because structure-like members are supported only for real types via Reflection. This example demonstrates how to create a custom XPCustomMemberInfo descendant to support nested persistent members.

See also:
K18482: How to create persistent metadata on the fly and load data from an arbitrary table
XPMemberInfo