Ticket Q382370
Visible to All Users

How to correctly implement XPWeakReference

created 13 years ago

I'm still trying to find a way how to correctly implement the XPWeakReference mechanism in my particular case. I have read all the available issues related to this topic but failed to find a complete guidance how to proceed with this task.
So I tried to follow your code and implement similar behaviour as in your Audit Trail Module. However with no success.
I exctracted what I finished with into an example project (can be found in attachement).
In my case, I'm trying to define persistent class Comment and implement weak reference mechanism to any other persistent class in project. In this example this classes are Event and WebSite. I would like to be able to implement a regular "add comment" feature to any object of this two types.
Could you help me in this matter and point out what I did wrong in my example.
Thanks a lot for your help.
Josef

Show previous comments (10)
Dennis Garavsky (DevExpress) 13 years ago

    Hi Josef,
    >>The major disadvantage in my opinion (correct me please if I'm wrong) is on the database side, where another level of table in Mapping Inheritance will appear, what brings another JOIN into each DB request (affecting performance)
    In my opinion, it is a common prejudice that negatively affects developers and their design decisions. Yes, it will bring another JOIN, but XPO is optimized to perform DB queries as soon as possible and thus it will not affect you in any way.
    If you ever experience any real performance problems with this, please let us know. However, I do not insist on using this solution and it is fully up to you to decide.
    >>What do you think about this approach (CommentExample3.zip)? Could it be a correct way?
    Yes, using aggregation is another way to accomplish this task. You will be probably pleased to hear that we use this design pattern in our Domain Components (DC) when emulating multiple inheritance.
    I have slightly modified your project to make it work as you expected. Please let me know if this was helpful.
    Thanks,
    Dennis

      Bingo! That is exactly a solution I've been looking for. Thanks a lot for your help.

      Dennis Garavsky (DevExpress) 13 years ago

        Welcome, Josef;-)
        Regards,
        Dennis
        =================================
        Please let us know what you think of our frameworks and other DevExpress products by rating them on the Visual Studio Gallery:
        eXpressApp Framework
        eXpress Persistent Objects
        =================================

        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.