The requested page is not available for the requested platform. You are viewing the content for Default platform.

BaseObject(Session) Constructor

Used to initialize a new instance of a BaseObject descendant, in a particular Session.

Namespace: DevExpress.Persistent.BaseImpl

Assembly: DevExpress.Persistent.BaseImpl.v19.1.dll

Declaration

public BaseObject(
    Session session
)
Public Sub New(
    session As Session
)

Parameters

Name Type Description
session Session

A DevExpress.Xpo.Session object which represents a persistent object's cache where the business object will be instantiated.

Remarks

The eXpress Persistent Objects, an object persistence framework used by XAF, demands that each persistent object must be tied to a Session. So, when implementing a business class derived from the BaseObject class, ensure that the business class has a constructor which takes a Session-type parameter and passes it to the BaseObject class constructor. If you create a new business object declaration in an XAF application via the XAF Business Object | XPO Business Object template, the created declaration automatically contains such a constructor:

[DefaultClassOptions]
    public class MyDomainObject : BaseObject {
        public MyDomainObject(Session session) : base(session) { }
}
Note

XAF manages persistent objects via Object Spaces (see XPObjectSpace). An Object Space exposes a Session object via its XPObjectSpace.Session property. So, if you need to create a new Session to interact with the database used by an XAF application, instantiate an XPObjectSpace via the XafApplication.CreateObjectSpace method, and use its XPObjectSpace.Session property.

See Also