NPOBase Objects

As of version 21.1.3, DevExpress has enforced some additional Non-Persistent Object rules. To help transition to this method of working with Non-Persistent Objects, we’ve added an NPOBase class.

    [DomainComponent]
    public class NPO : NPOBase
    {

        private string _Name;
        public string Name
        {
            get { return _Name; }
            set { SetPropertyValue<string>(nameof(Name), ref _Name, value); }
        }


        private Client _Client;
        public Client Client
        {
            get { return _Client; }
            set { SetPropertyValue<Client>(nameof(Client), ref _Client, value); }
        }

    }

This class allows you to continue using our propxaf code snippet which utilize the SetPropertyValue method to trigger the INotifyPropetyChanged interface’s PropertyChanged event. XAF uses this event to update the status of controls and actions.

To work with persistent objects in your NPOBase object, make sure to set the AutoAddObjectSpaceToNonPersistentObjectSpaces to True in the Model->Options node of your XAF module OR handle the ObjectSpaceCreated event in your module and add the necessary AdditionalObjectSpaces. Visit the DevExpress website for more details: https://docs.devexpress.com/eXpressAppFramework/116516/concepts/business-model-design/non-persistent-objects