• 2 minutes to read

In terms of XPO, the Session object represents a cache of the persistent objects that have been instantiated during data manipulations with a data store. A session uses a Data Access Layer (DAL for short) to retrieve the persistent objects from a data store and store them. A session automatically creates a DAL provided that the connection properties (such as the database name, user name and password) have been specified.

You can also use Unit of Work instead of sessions. When working with sessions you need to save each persistent object individually. While working with Units of Work all the changes made to persistent objects are automatically saved to a data store by making a single method call. This is because it tracks every change to every persistent object.

The connection is alive while a session is active, i.e. until the Session.Disconnect method is explicitly called. Disconnect is implicitly called when a Session object is disposed of.


Task-Based Help

Online Knowledge Base