Session
- 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.
Concepts
- Creating a Session
- Unit of Work
- Data Access Layer
- Object Access Layer
- Working with Sessions
- Optimistic Concurrency
- Processing Transactions
- Database Systems Supported by XPO
Task-Based Help
- How to: Connect to a Data Store
- How to: Connect to a SQL Server
- How to: Connect to SQL Azure
- How to: Connect XPO to a Database Other than MS SQL or MS Access
- How to: Connect XPO to a Database Server (ASP.NET)