Skip to Content

Entity Type Navigation with Generated Keys in xsodata

Hi everyone,

We have two entities on our xsodata service: MAINENTITY contains all the key values about our transactions (ID, customerID, orderID, cost, etc), while CUSTOMERENTITY contains the customer information (customerID, name, phone, address, etc).

MAINENTITY comes from a calculation view, as we use it to aggregate values to display on our OVPs and ALPs. Therefore, we don't specify a key, but generate it locally when exposing the service. However, on the OVP we want to translate the customerID on MAINENTITY to the customer name on CUSTOMERENTITY. Because we generate keys locally, we can't set MAINENTITY as the principal of the association, and thus can't create the navigation property and WebIDE/OVP can't reach the name value from CUSTOMERENTITY.

Has anyone faced a similar problem? How to best deal with translation entity sets and navigation?

Best regards,


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Aug 01, 2018 at 02:56 PM

    You can create a navigation association on a non-key attribute. Here is an example that does this with a Calcuation View based entity and a generated key:

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Thomas Jung, thanks for the reply. On that example, the principal entity doesn't aggregate and don't have generated keys, right? If I try to set one that aggregates with a generated key as principal, I get the "The Principal of a ReferentialConstraint does not specify Key property "GenId" of the EntityType" error.