Ticket Q478931
Visible to All Users

How to use Signle() function in PersistentAlias with Many-To-Many scenario

created 12 years ago

In my application, I have an extended Many-To-Many relation

scenario, where Aircraft is being used by Party in particular time interval
described in relation table AircraftInclusion. It means Aircraft -->>
AircraftInclusion <<-- Party. Now I need to define a persistent alias
Aircraft.CurrentOperator, which returns Party from currently valid
AircraftInclusion (for simplicity I assume only one instance of
AircraftInclusion per Aircraft in my examples below. I tired several variants
of Aircraft.CurrentOperator implementation resulting with different error
messages in XAF application.

C#
[PersistentAlias("AircraftInclusions[].Single(Party)")] public Party CurrentOperator { get { return EvaluateAlias("CurrentOperator") as Party; } }

ERROR MESSAGE: The 'Party' property path is incorrect for the 'ELVAC.AIS.Model.FlightManagement.Aircraft' type because the 'ELVAC.AIS.Model.FlightManagement.Aircraft.Party' member does not exist

C#
[PersistentAlias("[<AircraftInclusion>][^.Id = Aircraft.Id].Single(Party)")] public Party CurrentOperator { get { return EvaluateAlias("CurrentOperator") as Party; } }

ERROR MESSAGE: The 'Party' property path is incorrect for the 'ELVAC.AIS.Model.FlightManagement.Aircraft' type because the 'ELVAC.AIS.Model.FlightManagement.Aircraft.Party' member does not exist
 How this could be? In this to case above I’m querying
explicitly defined AircraftInclusion type? The Party property used in argument
of Single function defines only what property from result (AircraftInclusion)
should by returned? Is it correct? (there is no documentation of Single
function at all, so I can only assume).

C#
[PersistentAlias("Iif(CurrentAircraftInclusion IS NOT NULL, CurrentAircraftInclusion.Party, NULL)")] public Party CurrentOperator { get { return EvaluateAlias("CurrentOperator") as Party; } } [PersistentAlias("AircraftInclusions[].Single()")] public AircraftInclusion CurrentAircraftInclusion { get { return EvaluateAlias("CurrentAircraftInclusion") as AircraftInclusion; } }

ERROR MESSAGE: Incorrect member 'CurrentOperator' in a path. A reference property or collection association is expected.
Thanks a lot for any advice, example or (in best case)
reference to documentation of Single function.

Show previous comments (14)
DevExpress Support Team 12 years ago

    After removing incorrectly implemented BossAddressVariantBA and BossAddressVariantBB properties, I cannot reproduce any exception in your project. Property BossAddressVariantA is implemented correctly.

    SU SU
    Svatopluk Ulicny 12 years ago

      I can not agree. I did it again and attached screenshot.
      Do I something different/wrong?

      DevExpress Support Team 12 years ago

        I cannot reproduce this issue on my side, sorry. See the attached video.
        Note, I have tested your project with the latest release version (12.2.6) of our libraries. I you are using an older build, please update the DXpereince installation.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.