Ticket T156952
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

How to customize the UnitOfWork behavior in XPO-based XAF applications

XPO and SQL Server Auto Increment Primary Key Fields

created 10 years ago

Looking at Q368491 A solution was posted on the bottom using a custom attribute.

The MySession class inherits from DevExpress.Xpo.Session and overrides the GetPropertiesListForUpdateInsert method so that when a

[IgnoreInsertUpdate]field/property attribute is detected, the field or column in the update/insert statement would be omitted.

I would like to know where In the business object I could use MySession instead of the default session below:

C#
public partial class test { public test(Session session) : base(session) { } }

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello Andre,

This should be done outside the business object. The object's Session property is assigned when this object is loaded to a Session. So, you need to change the Session to which this object is loaded. For example, if you are using an XPCollection, assign your custom Session to the XPCollection.Session property, or pass this Session to the collection's constructor.
If you are using the default Session (do not pass a Session to data sources explicitly), assign an instance of your custom Session type to the XpoDefault.Session property.

    Show previous comments (5)
    Anatol (DevExpress) 10 years ago

      Ensure that you have set the XpoDefault.TrackPropertiesModifications property to true in the service application. It is insufficient to set this property in the client application, since static values are not shared between different applications.

        Thank you once again :)

        Anatol (DevExpress) 10 years ago

          You are welcome!

          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.