When you have a table with a composite key, a usual solution is to declare a structure for the key member as described in the A2615 article. If the database schema is not known as design time, and you need to create persistent classes at runtime, there is no option to create a structure-like entity as this functionality is supported only for real types via Reflection. The example demonstrates how to create a custom XPCustomMemberInfo descendant with nested members support.
See also:
K18482: How to create persistent metadata on the fly and load data from an arbitrary table