Ticket T1057333
Visible to All Users

How to reload all related associated collections

created 3 years ago (modified 3 years ago)

[DevExpress Support Team: CLONED FROM T1054371: Q359904: How to modify objects/properties in code when the user does not have the permission seems to not work.]

Hello Andrey,

I have a last question: could you please tell me how to force "reloading" all related associated collections of an object without using an external call?
I mean something like:

C#
payCard.Reload()

Thanks in advance.
D

Show previous comments (7)

    Hello,
    You are right.
    What I want to avoid is specifying the Criteria ("PayCard = ?") that is already builtin in the collection "PayCardUsages" of the PayCard object.
    Could you tell me if my above proposal is acceptable or if you see any side effect?
    Thanks
    D

    Anatol (DevExpress) 3 years ago

      Hello D,

      The XPCollection(Session, Object, XPMemberInfo) constructor is used in our code to get associated collections. If you use it in your code, you will get the same result. However, note that it is intended for internal use.

        Thanks, is seems to be the best solution except when the original collection is not yet loaded.
        In the above case neither my suggested method:

        C#
        (new XPCollection(Session, this, Session.GetClassInfo<PayCard>().FindMember(nameof(PayCardUsages)))).Load();

        or your suggested method:

        C#
        var payCardUsages = new XPCollection<PayCardUsage>(Session, CriteriaOperator.Parse("PayCard = ?", this.Oid));

        works. It is necessary to load the original collection first then use one of the above methods.
        Thanks
        D

        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.